![]() |
|
|
|
|
|
Ext2- Part II: Inside the bonnet
By Vans Information <Content@vansinfo.com>
A file system usually comprises of blocks of data. A typical filesystem volume starts with a `Super Block’, which has all information regarding used and unused blocks as well as availability and location of various inodes. Only the superuser can access super block. Blocks We have two kinds of blocks: Physical and Logical. Physical blocks are those that reside on the actual storage media, where the data is kept and has a fixed size. Logical blocks, on the other hand, are those whose size is specified once the filesystem is created. Logical blocks are further divided into smaller logical units called as fragments. A logical block consists of an integral number of fragments. This logical block size need not be the same as the physical block size. It is the job of the file system driver to provide the mapping from the logical block size to the physical block size. A single logical block is divided into an integral number of physical blocks. Ext2 has a default logical file size of 4k. The filesystem volume starts with block 0, which is called the ‘boot’ block, which is available on the ext2 filesystem too. The blocks on disk are divided into groups. Each of these groups duplicates critical information of the file system. Moreover, the presence of block groups on disk allows the use of efficient disk allocation algorithms. Each group contains the following: The Super Block: In the ext2 filesystem, superblock is the area which can be accessed by the superuser only. The superuser is that area of the filesystem, which stores information about the number of free blocks, free inodes, logical block size, the number of times the volume has been mounted, and other accounting information about the filesystem. Group Descriptors: Immediately following the Super block on the disk are the group descriptors. They hold critical information about the groups in the filesystem. Each group descriptor describes one group. Block Bitmap of the Group: In order to account for the usage of the blocks on the filesystem, the ext2 filesystem consists of a block bitmap. This keeps track of blocks that have been used and those that are free. Each bit in the Block Bitmap denotes an integral number of fragments. So if a bit is allocated to a file and marked as used, then an entire set of fragments are allocated to it. The Block Bitmap is a clever way to keep track of new empty and old used ones. In order to look for a block, one needs to check the group to which the file belongs. Then the Block Bitmap of the appropriate `Group’ is selected and searched for the required block. Inode Bitmap of the Group: Similar to the blocks, the inodes assigned to the various files need to be taken into account. The inode stores all information about a file. A fixed number of blocks are usually allocated for storing the Inode Table, which stores all the file inodes. The inodes also contain pointers to disk blocks where the actual files are stored. The Inode bitmap is provided to check for allocated blocks and free them when files are deleted from the system. Inode Table of the group: Inode Table contains an array of records (inodes), which are basically arrays of structures, containing Meta information about the file. This information includes the filename, the file size, a pointer to the disk blocks containing the file, the file creation, access and modification times, the number of links to the file, as well as the user and group ids of the file. The structures of the pointers to disk blocks are arranged in such a manner that they can be easily accessed. The inode contains 15 pointers to blocks. Of these pointers, the first 12 are direct pointers to data. The following entry is indirect pointers to data. The next one points to `a block of pointers’ to `blocks of pointers’ to `data’ (double indirect). And another entry points to a `block of pointers’ to `a block of pointers’ to `a block of pointers’ to `data’ (triple indirect). After these data structures follow the disk blocks on which the actual blocks of data are stored. Directories: A `directory, is used for logical organization and security of files on a file system. It is a standard feature of most file systems. On an ext2-based system, a directory has a specific structure. This structure contains the length of the record, the inode number associated with it, as well as the name and the length of the filename. The first two entries are ‘.’ and ‘..’ respectively for every directory. Easy operations It is interesting to note how some of these features make common operations on a filesystem a lot easier. Take the example of moving a file or a directory to another directory. Here we merely change the inode number for the ‘..’ entry in the directory, and this accomplishes our ‘move’ operation. Creating a symlink to a file simply requires a change in the inode entry of the newly created ‘symlink’ file. Access Control Lists The Ext2 filesystem provides support for Access Control Lists (ACL), although they are not fully used. ACLs basically consist of a list of resources for which users of a system give requests for access. Accesses are of three types: Read, Write and Execute. Control Lists store the permissions for each resource for each user of those resources. Any access to the resources is granted only after checking with the Access Control List. Once permitted, the ACL provides mutual exclusion for resources, although it may allow read/share access depending on the policies.
The Second Extended File System - Part I
Other articles by Vans Information
Current Rating: [ 6.68 / 10 ]
Number of Times Rated: [ 40 ]
|
|
|
© 1998-2004 FreeOS Technologies (I) Pvt. Ltd. All rights reserved.
[Privacy Policy]
![]() |