Part 1 of 7 · 2 min read
Why this page comes second
In this module you will
- Name the regions of a simple file system on disk and say what each holds.
- List what an inode stores, and what it does not store.
- Compute where an inode lives on disk from its number.
- Read a directory entry on disk, and say what
unlinkchanges in it. - Explain block groups, and why a file system can run out of inodes with free space left.
Page 1 described files, directories and links as a program sees them. This page opens the disk and shows how those objects are stored in numbered blocks (Level 8). The layout used here is that of the ext family, which Linux uses most often, and it is typical of Unix file systems. Page 3 then shows how a file's blocks are chosen and tracked, and page 4 shows how the structures are kept correct after a crash.
About this example About this example
Real: All listings come from a 16 MiB file system image made on a Linux test machine (kernel 6.18, e2fsprogs 1.47.0) with mkfs.ext4 -b 4096 -O ^has_journal (no journal, to keep the picture small; page 4 adds it). The tools dumpe2fs and debugfs and the C program in section 3 read that image. A second image with 128 inodes gave the figure of 117 files in the exercises.
Scripted: The inode number 4,000 in section 3 and the 1 TiB file system in section 5 are made up to show the idea. Their results are computed, not measured.
Not real: A real disk has many block groups and a journal, and flex_bg places some bitmaps and tables of many groups together. The image here has one group. The C program does not handle other layouts, other inode sizes in a group descriptor beyond the first group, or damaged images.