The File System 1 Linux File System Linux





























- Slides: 29
 
	The File System 1
 
	Linux File System • Linux supports 15 file systems – ext, ext 2, xia, minix, umsdos, vfat, proc, smb, ncp, iso 9660, sysv, hpfs, affs and ufs • The separate file systems are combined into a single hierarchical tree structures – mount on a directory (mount point) 2
 
	Virtual File System • Disks are initialized into logical partitions • Each partition may hold a single file system – EXT 2 • The real file systems are separated from the operating system by an interface layer: Virtual File System 3
 
	The Second Extended File System (EXT 2) • File : data blocks • inode : describe which blocks the data within a file occupies, access rights, modification time, … • directory : special file which contains pointers to the inodes 4
 
	Physical Layout of EXT 2 5
 
	The EXT 2 Inode 6
 
	The EXT 2 Inode • Mode – what this inode describes (file, directory, symbolic link, FIFO, …) and the permissions • Owner Information – user and group ids of the owners • Size 7
 
	The EXT 2 Inode • Timestamps – creation and modification • Datablocks 8
 
	The EXT 2 Superblock • Basic size and shape of the file system – Magic Number : 0 x. EF 53 – Revision Level – Mount Count and Maximum Mount Count – Block Group Number – Block Size – Block per Group 9
 
	The EXT 2 Superblock • Basic size and shape of the file system – Blocks per Group – Free Blocks – Free Inodes – First Inode 10
 
	The EXT 2 Group Descriptor • • Block Bitmap Inode Table Free blocks count, Free inodes count, Used directory count 11
 
	EXT 2 Directory 12
 
	Finding a File in an EXT 2 File System • /home/rusling/. cshrc • system parse the filename a directory at a time until we get the file 13
 
	Changing the Size of a File in an EXT 2 File System • Lock EXT 2 Superblock • Check if there are preallocated blocks • EXT 2 allocate new block – data block after the last block of the file – data blocks within 64 blocks of the idea block – data block in the same Block Group 14
 
	Changing the Size of a File in an EXT 2 File System – All of the other Block Groups in turns (allocate a cluster of eight blocks) • Update the Block Group’s block bitmap and allocate a data buffer in the buffer cache • Mark the superblock as “dirty” and unlock 15
 
	The Virtual File System(VFS) 16
 
	The VFS Superblock • • • Device Inode pointers Blocksize Superblock operations File System Type File System specific 17
 
	The VFS Inode • • Device Inode Number Mode User id times block size inode operations – a pointer to a block of routine addresses • • count lock dirty file system specific 18
 
	Registering the File Systems • Build Linux kernel : supported file systems • Build file systems as modules – load by ismod 19
 
	Mounting a File System • $mount -t iso 9600 -o ro /dev/cdrom /mnt/cdrom • Search for the file system types( iso 9600) • Allocate a VFS superblock and pass it the mount information to the superblock read routine 20
 
	A Mounted File System 21
 
	Umount a File System • Check whether someone is using the FS • Check if the FS is dirty – write back • Return VFS superblock to kernel’s pool • vfsmount is unlinked from vfsmntlist 22
 
	Speedup Access • VFS Inode Cache • Directory Cache 23
 
	The Buffer Cache 24
 
	The States of the Cache • Clean : Unused, new buffers, • Locked – Buffers that are locked, waiting to be written, • Dirty – Dirty buffers. These contain new, valid data, and will be written but so far have not been scheduled to write, 25
 
	The States of the Cache • Share – Shared buffers, • Unshared – Buffers that were once shared but which are now not shared, clean : Unused, new buffers, 26
 
	The bdflush Kernel Daemon • The bdflush kernel daemon is a simple kernel daemon that provides a dynamic response to the system having too many dirty buffers (default : 60%) • The value can be seen and changed using update command (a daemon) 27
 
	The /proc File System • It does not really exist • Presents a user readable windows into the kernel’s inner workings 28
 
	Devices Special Files • Hardware devices • character and block devices • device drivers – major number, minor number 29
