The Second Extended File System - An introduction
This file system, which draws its inspiration mainly from the Minix file system of the older days written by Andrew Tanenbaum, was the only file system that was available with a free operating system called “Minix”. It was later modified to be used with the Linux system and was called the Extended File System. The Linux file system being used now, called ext2 (Second Extended File System), is a newer version of the Extended file system that also supports the Access Control Lists (ACL).
But, before embarking on a detailed study of the ext2 file system, lets get acquainted with the terminology associated with file systems and volumes. In the later articles we will investigate the design of the ext2 filesystem.
Block: Files on disk are stored in an integral number of fixed size blocks. The size of the blocks is usually a power of 2. By default, the block size of the ext2 file system is 4K. Research, shows that 4K is the most optimal size for a disk block. If the size of a file does not come to a multiple of 4K, part of the last disk block (on an average, half a block) is wasted. In the worst of cases, almost an entire block, having just one byte of the file, is wasted.
The situation is a bit tricky here. If we select a larger block size, then there is wastage of disk space for small-sized files. On the other hand, if we use a very small block size, the number of disk blocks increase exponentially, thereby taking up more book-keeping time for the files. Therefore, selection of blocks has to be given careful thought.
When a file is loaded into memory, the disk blocks are loaded into the buffer cache in main memory. If they are modified, the blocks in the buffers are marked as `Dirty’. It means that these blocks have to be written to disk in order to maintain consistency between the blocks on disk and those in main memory.
Superblock: Superblock is a region at the beginning of every file system where information like the size of the file system, the empty and the filled blocks, their respective counts, and other such data, is stored. A request to access any file from a file system requires access to the file system’s superblock. If the superblock is damaged, then it may be difficult to retrieve data from the disk.
Inode: An inode is an entry in a table for the file system called the Inode Table. The inode contains all kinds of information about the file including its name, size, the number of links, date and time of creation, modification and access. It also contains pointers to the disk-blocks where the file is stored.