Operating System & Administration UNIT-III Introduction to File System.

Slides:



Advertisements
Similar presentations
The UNIX File System Harry Chen Department of CSEE University of MD Baltimore County.
Advertisements

Concepts about the file system 2. The disk structure 3. Files in disk – The ext2 FS 4. The Virtual File System (c) 2013, Prof. Jordi Garcia.
Basic Unix system administration
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
A Guide to Unix Using Linux Fourth Edition
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Linux+ Guide to Linux Certification, Second Edition
Linux Linux File System.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Guide To UNIX Using Linux Fourth Edition
Linux Installation and Administration – Lesson 5 Tutor: George Papamarkos Topic: Devices in Linux.
Chapter 8 File Management
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 8. Disks and Filesystems. Ordinary Files u What is a file? –a container for ordered data –persistent (stays around) and accessible by name u Unix.
Linux Filesystem Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Unix Basics Chapter 4.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Linux+ Guide to Linux Certification, Second Edition
Chapter Two Exploring the UNIX File System and File Security.
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
UNIVERSITY OF COLOMBO SCHOOL OF COMPUTING IT5501 Systems & Network Administration DEGREE OF BACHELOR OF INFORMATION TECHNOLOGY.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter Two Exploring the UNIX File System and File Security.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
File system In computing, a file system is a method of storing and organizing computer files and the data they contain to make it easy to find and access.
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
Linux file systems Name: Peijun Li Student ID: Prof. Morteza Anvari.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Lecture 4 & 5: System Architecture  File systems  Devices  File system permissions  Review of Linux runlevels  In-class exercise.
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
File System Interface CSSE 332 Operating Systems
Filesystem Management and Backups
Linux 101 Training Module Linux Basics.
UBUNTU INSTALLATION
Linux file system "On a UNIX system, everything is a file;
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
Exploring the UNIX File System and File Security
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Operating Systems Lecture 4.
Department of School of Computing and Engineering
Perl Scripting and The File system
The Filesystem Chapter 5.
Chapter 5 The Filesystem
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Operating System & Administration UNIT-III Introduction to File System

OUTLINE 1.PathName 2.File System Mounting and Unmounting 3.Organization of File Tree 4.File Type 5.File Attribute 6.Access Control List

What is a file File is a collection of data items stored on disk. Or, it's device which can store the information like data, music (mp3 files), picture, movie, sound, book etc. In fact whatever you store in computer it must be in the form of file. File is the last object in your file system tree.

Component of File System A namespace – a way to name things and organize them in a hierarchy An API – a set of system calls for navigating and manipulating objects A security model – a scheme for protecting, hiding, and sharing things An implementation – software to tie the logical model to the hardware. Note:- file should not contain / in between file name characters.

Modern kernels define an abstract interface that contains many different back-end filesystems. Windows - NTFS, FAT Linux - Ext –Ext2 –Ext3 –Ext4

Linux file system(History) It has maximum size limit of 64 megabytes There was also a filename length limit of 14 characters. In 1991 a new file system came with addition of new file system as a layer on top of linux kerenl that provide generic file API. Termed as VFS termed as ext. But has problems like allowed 2 gigabytes of data and filenames of up to 255 characters. with problems like there was no support for separate access, inode modification and data modification with timestamps.

Ext2:- –Introduced in 1993 by Rémy Card. –maximum filename length of 255 characters –has variable length block size(maximum data size of 2047 gigabytes). –Maximum individual file size can be from 16 GB to 2TB –Overall ext2 file system size can be from 2 TB to 32 TB

Ext3:- –Introduced in 2001 by Stephen Tweedie –The main benefit of ext3 is that it allows journaling. –Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling. –maximum filename length of 255 characters –Maximum individual file size can be from 16 GB to 2 TB –Overall ext3 file system size can be from 2 TB to 32 TB

Ext4 It was introduced in Starting from Linux Kernel ext4 was available. Supports huge individual file size and overall file system size. Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).

Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3) You can also mount an existing ext3 filesystem as ext4 filesystem (without having to upgrade it). Several other new features are introduced in ext4: – multiblock allocation, – delayed allocation, – journal checksum. fast fsck, etc. –All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3

11 Filesystem Hierarchy Standard Started by Dennis Ritchie, 1993 Defines the main directories and their contents in most Linux-based systems

12 FHS There is no any drive C:, D:, … All directories are under “/” –“/” is the root directory It is possible –to have multiple partitions –to multiple filesystems

13 The “/” The primary hierarchy in FSH –The root of tree of filesystem All paths start form here There is only one “/” in filesystem

Pathname What is Path Path Types Setting Path

What is path A path is a unique location to a file or a directory in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters Ex. –/home/fedora/abc.txt –/etc/passwd –/proc/partitions –/etc/yum.d/yum.conf

Path Types in Linux Absolute path -An absolute path is defined as the specifying the location of a file or directory from the root directory(/). -In other words we can say absolute path is a complete path from start of actual filesystem from “ / “directory Relative path -Relative path is defined as path related to the present working directory(pwd).

Examples of relative path and absolute path Example1: Present location is /abc/xyz, remove /abc/xyz/read/hello.txt file. Using relative path: rm read/hello.txt Using absolute path: rm /abc/xyz/read/hello.txt

Example2: My present location is /etc/samba and now I want to change directory to /etc. Using relative path: cd.. Using absolute path: cd /etc Note:- there should be no ‘/’ in file Name Ex:-“abc/pqr” it will be assumed that pqr is in abc directory

19 The Organization Of The File Tree

boot Linux kernel Boot loader configuration vmlinuz is a executable that loads operating system in memory.(vmlinuz is a kernel). If you lost boot –You cannot boot your OS

21 boot Grand Unified boot Loader Dev by Erich Stefan Boleyn

22 bin Essential programs Need for system startup Common programs, shared by the system, the system administrator and the users. Basic commands for –Navigating in filesystem –File management

23 bin

24 dev Everything is file –Hardware components (devices) are file Hard disk Key board All device files are here Direct interaction with device driver –Open the device file –Read & Write

25 dev

etc System configuration directory Critical startup and configuration files All configuration file are text files –You can view and edit it manually

27 etc

28 home Home directory of user Each user has a directory –/home/xyz –/home/abc All files of user are stored here

29 lib Libraries, shared libraries and parts of the C compiler Programs need libraries –Dynamically linked libraries All essential libraries are here –Needed for system startup

30 lib

31 proc Information about all running processes It represent current state of kernel

Directories with names as numbers Do a ls -l /proc, and you’ll see lot of directories with just numbers. These numbers represents the process ids, the files inside this numbered directory correspond to the process with that particular PID Following are some file located in proc directory as cmdline – command line of the command. environ – environment variables. fd – Contains the file descriptors which is linked to the appropriate files. limits – Contains the information about the specific limits to the process.

Files about the system information It contains system information such as cpuinfo, meminfo, /proc/cpuinfo – information about CPU, /proc/meminfo – information about memory, /proc/partitions – partition related information, /proc/version – linux version

mounts – mount related information

35 proc

36 root Home directory of root user or super user Don’t confuse – / is the “root of Filesystem” – root is the name of system admin – /root is the admin

37 sbin It contains executable programs (ready to run). They are mostly admin tool and made available to root user. System configuration programs –Format hard disk (fdisk,fsck, ifconfig,modinfo(info for kernel module) –Halt, reboot,fasthalt(stop system without disk checking).

/sbin should contain only binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.

39 sbin

40 tmp Temporary directory All temp files are created by programs Your temp files It is emptied regularly

41 usr It contains all the user binaries, their documentation, libraries, header files, etc and its supporting libraries can be found here. Also termed as Secondary hierarchy Very useful programs –We usually use them for compiler, tools Are not essential for system startup

/usr/bin:- –This directory contains the vast majority of binaries on your system. – Executables in this directory vary widely. –For instance vi, gcc, gnome-session and mozilla and are all found here. /usr/doc:- –The central documentation directory. –Documentation is actually located in /usr/share/doc and linked from here.

43 usr

44 var Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files. Some portions of /var are not shareable between different systems.like –/var/log, /var/lock, and /var/run. The shared – /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/new The variable directory All dynamic files, User cannot change the files

45 var

47 File Types Filesystem implementation define seven types of files 1.Regular files 2.Directories 3.Character device files 4.Block domain sockets 5.Local domain sockets 6.Named pipes (FIFO) 7.Symbolic links

48 How to create and remove files

49 Regular File : It is consist of a series of bytes, filesystems impose no structure on their contents. Example: text files, data files, executable programs. Directories : It contains named references to other files.

50 Character and Block device files : Device files let programs communicate with the system’s hardware and peripherals. The kernel loads driver software for each of the system’s devices. Character device files allow their associated drivers to do their own i/p and o/p buffering. Device Driver Files Hardware Program request

51 Block device files are used by drivers that handle i/o in large chunks and want the kernel to perform buffering for them. Device files are characterized by two numbers, called the major and minor device numbers. The major device number tells the kernel which driver the file refers to, and the minor device number typically tells the driver which physical unit to address.

52 Local domain sockets : Sockets are connections between processes that allow processes to communicate. Local domain sockets are accessible only from the local host and are referred to through a filesystem object rather than a network port.

53 Named pipes : It also allow communication between two processes running on the same host. It is also known as “FIFO files”

54 Symbolic links : Symbolic or “soft” link points to a file by name. Pathname stored as the contents of the link. Links : hard link and soft link Hard link is a direct reference Soft link is a reference by name

55 File Attributes 1. Permission bits : Every file has a set of nine permission bits that control who can read, write, and execute the contents of the file. There are 3 basic permissions –Read (r) –Write (w) –Execute (x) How to change them –chmod +/- r/w/x

56 File permissions in terms of octal numbers because each digit of an octal no. represents three bits and each group of permission bits consists of three bits. In each triplet bits, the high bit is the read bit, middle bit is the write bit, and low bit is the execute bit. Two types of executable files exist: binaries, which the CPU runs directly, and script, which must be interpreted by a shell (bash or sh scripts).

57 2. Chmod : change permissions Chmod cmd changes the permissions of a file. Only the owner of the file and the superuser can change its permissions. Permission encoding for chmod:

58 3. chown and chgrp : change ownership and group: Using –R flag to change the setting of a directory and all the files underneath. Example : chown –R user:group dir/.* 4. umask : assign default permissions

60 Mounting and Unmounting Mount : –To add a filesystem to other filesystem Filesystems are attached to the tree with the mount cmd. Mount maps a directory within the existing file tree, called the mount point, to the root of the newly attached filesystem. The previous contents of the mount point become inaccessible as long as another filesystem is mounted there. Mount points are usually empty directories.

61 How? –mount –mount -t vfat /dev/sdb1 /mnt/flash To detach filesystems with the umount cmd. Don’t forget the umount –umount –umount /mnt/flash

Access Control List What is an ACL? – Access Control List: collection of Access Control Entries (ACEs) associated with a file. What is an ACE? – A structure specifying permission for a user, group, or other entity.

setfacl User command utility to set, modify, or delete ACLs on a file Can be ran by file owner or anyone given permission to modify permissions Sample commands: – setfacl –s u:alice:+rx:i myFile – setfacl –m o::drwx myFile – setfacl –u myFile – setfacl –d u:alice myFile

getfacl User utility to examine the ACL on a particular file Examines a file’s inode to detemine what permissions are set Sample: – getfacl myFile