1 / 29

Linux The File System

File Systems Supported. Linux supports many file systems, some of them are as follows: ext, ext2, xia, minix, umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs, affs and ufsFirst we will examine the EXT2 file system as it is commonly used with Linux.Then we will compare this with the MS-DOS

townsend
Download Presentation

Linux The File System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Linux & The File System by Dale Brunner CS430 Spring 2006

    2. File Systems Supported Linux supports many file systems, some of them are as follows: ext, ext2, xia, minix, umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs, affs and ufs First we will examine the EXT2 file system as it is commonly used with Linux. Then we will compare this with the MS-DOS file system.

    3. History Minix was the first file system of Linux since the first linux code was written on a machine using that FS. Minix had some shortcomings and as drive size grew, a new FS work began on a new FS for Linux. EXT was released in April 1992, and was the first to use the VFS API. As drive size increased further and further metadata information was desired by users, EXT2 was developed.

    4. EXT2 One popular file system for Linux is EXT2 As we learned, data held in files is kept in data blocks all of which are the same length. Each file in the system is described with an inode data structure. The inode contains the specifics of the file the permissions, last access time, the blocks where data resides, etc.

    5. EXT2 - inodes Each inode has a unique ID number. The inodes are stored in inode tables. Directories are essentially inodes that point to other inodes. EXT2 divides any logical partition that it occupies into block groups. These groups not only hold file and directory information but also have a copy of data that can be used to recover the file system should corruption occur.

    6. EXT2 Disk Layout

    7. EXT2 inode diagram

    8. EXT2 inode Overview From the diagram we know that EXT2 uses a combined scheme of indexed allocation (using both linked and multilevel index blocks) as described in our textbook. There are 12 direct blocks that point directly to blocks with data followed by indirect blocks which use one or more level(s) of index blocks. The kernel keeps a hashtable of inodes in the inode cache (which resides in memory) hash value is based on superblock address and inode number.

    9. EXT2 - Superblocks The superblocks contain information about the general size and shape of the file system they can be used to recover the system should corruption occur. A superblock holds the following information: magic number, revision level, mount count, block group number, block size, blocks per group, free blocks, free inodes, first inode.

    10. EXT2 - Superblock Components Magic number: a number provided as a mechanism for the OS to check that the superblock belongs to the FS it says it does. Revision level: this is the version of the file system and is used to determine compatibility. Mount count, maximum mount count: mount count is incremented each time FS is mounted up to the max. Block group number: the number of the block group that this superblock is a part of. Block size: the size of a block in bytes. Blocks per group: obviously, number of blocks per block group. Free blocks: number of free blocks in the entire FS Free inodes: number of free inodes in the FS First inode: inode number of the first inode in the FS

    11. EXT2 Group Descriptor Like superblocks, all group descriptors are duplicated in each block group in case of file system corruption. A group descriptor describes a block group and contains the following information: blocks bitmap, inode bitmap, inode table, free blocks count, free inodes count, used directory count.

    12. EXT2 - Directories

    13. EXT2 Directory Overview The first field in the directory entry is the inode an index into the inode table of the block group. The second field is the length in bytes of the directory entry. The third field is the name (i.e path) of the file.

    14. Another Widely Used FS: MS-DOS

    15. MS-DOS: Bootstrap Sector

    16. MS-DOS: Bootstrap Sector (cont).

    17. MS-DOS: FAT

    18. MS-DOS, FAT16, FAT32 The DOS file system is sometimes referred to the FAT12 file system because it uses 12 bits for each entry in the FAT The FAT16 file system was created to accommodate larger disks as it used 16 bits for each entry in the FAT The FAT32 file system was, obviously, designed to use 32 bits in each entry in the FAT in order to support even larger disks.

    19. Playing with the Linux FS Now we will examine some of the structure of the Linux FS code. First, a look at the structure of both the inode and superblock and a description of some of their components. Then a look at the structure of the superblock operations (which is a C struct containing the operations that can be done to the superblock).

    20. Playing with Linux FS: inode Structure

    21. Playing with Linux FS: Superblock Structure The following is the struct representing the superblock:

    22. Superblock struct: Explained

    23. Superblock Operations: Now lets look at some operations we can perform on the superblock:

    24. Superblock Operations Explained

    25. The VFS What is it? Well, as we learned it is a way to provide a level of abstraction when dealing with disk access. The VFS provides an API whenever a process needs to read or write, rather than having to know about all the hardware specifics it just tells the OS, Hey, write this thing to disk and I dont care how. The OS calls the VFS read/write function which in turn calls on the appropriate file system read/write function which uses device drivers to perform disk operations.

    26. VFS Diagram

    27. Modifying the VFS A simple modification of the VFS allows us to see when the Linux kernel is using the sys_open system call. The code I modified is located in linux/fs/open.c

    28. Final Notes: EXT3 vs EXT2 Why did I choose to provide information about EXT2? Well, its essentially the same as EXT3 except that EXT3 has journaling whereas EXT2 does not. Journaling, as we have discussed is a way of logging what is about to happen so that in the event of a system failure the log can be used for recovery.

More Related