Appearance
28. File System Structure
A file system is the layer between open("file.txt") and actual bits on disk.
+----------------------+ Block 0
| Boot Block |
+----------------------+
| Superblock |
+----------------------+
| Inode Bitmap |
+----------------------+
| Data Bitmap |
+----------------------+
| Inode Table |
+----------------------+
| Data Blocks |
+----------------------+- Boot Block: first block on disk; holds bootloader code. Every disk has one, even non-bootable ones.
- Superblock: filesystem-wide metadata — total inodes/blocks, free counts, filesystem type, block size. Corruption here can lose the whole filesystem, so OSes keep backup copies.
- Inode Bitmap / Data Bitmap: one bit per inode / per data block, marking used vs free.
- Inode Table: the array of all inodes, fixed size, created at format time.
- Data Blocks: the actual file contents (directories are stored here too, as special files mapping names to inode numbers).
Common filesystems: ext4 (Linux, journaling), NTFS (Windows, permissions + journaling), APFS (macOS, snapshots + encryption), FAT32 (universal, simple, no permissions), XFS (Linux, high performance for large files).