Linux and UNIX File System Drivers
Although specific details vary greatly, both UNIX and Linux implementations have many common characteristics. UNIX file system implementations are decentralized. While file system implementations of the Microsoft category store most metadata about files in central locations (MFT or FAT), UNIX records the metadata in specialized data structures spread throughout the hard disk.
This fundamentally different approach intermixes data, metadata and hierarchical or structural information. Traditionally, UNIX file system implementations accomplished this by maintaining several distinct block types throughout the hard disk.
Boot Block: This block is reserved to store the software necessary to
Data Blocks: These blocks store the actual file content.
Inode Blocks: These blocks store all metadata about a file and
Superblock: These blocks store key information about the disk and partition. Copies of the superblock are distributed across the partition and are updated regularly.
Examples of the data stored in this block are:
Size of partition
Number and list of free blocks. The product of the block size and the number of free blocks is the quantity of free disk space.
Index of the next free block
Size of the inode list
Number of free inodes. The amount of inodes is fixed when the partition is formatted. Because it is fixed, it is possible to exhaust inodes before hard disk capacity.
More recent innovations have allowed a new hybrid data/inode block. Data blocks that contain only small amounts of data can be stored inside the inode. Therefore, the inode actually contains the data, and not references to the data. Bad spots on the disk are tracked and stored in special purpose inodes. The bad spots are called "bad blocks", and the inodes that track them are referred to as "bad block" inodes.
Directories are merely files with no data. Each directory is implemented by creating an inode that references no data blocks. Instead, it contains the file name, characteristics and inode number for each file. Deletion of files or directories occurs by marking the file as deleted in the directory inode. The content, inode and directory inode entry are preserved in most cases. However, both the inode and the data blocks referenced by the inode are considered free to be reused.