Curriculum / Part 1 · Foundations: what storage even is
Lesson 5

Filesystems 101

Inodes, extents and journaling; how XFS and ext4 differ at a concept level; and how a disk can be 'full' with free space.

⏱ 35 min5-question quizLab 1.3

The simple version

A filesystem is a library catalogue. Each book has a catalogue card (an inode) saying who owns it, how big it is and which shelves its pages are on. The pages themselves sit on the shelves (data blocks).

If the library runs out of catalogue cards, it can't take a single new book even with empty shelves everywhere.

Inodes

An inode stores a file's metadata: mode, owner, size, timestamps and where its data lives. The file name lives in the directory entry that points at the inode, not in the inode itself.

$ stat train-00001.tar
$ df -i /data

df -i shows inodes used and free. Millions of tiny files can exhaust inodes long before bytes run out.

Extents

Old filesystems tracked every block of a file individually. ext4 and XFS use extents: "blocks 10,000 to 18,191 belong to this file" is one record. Large, contiguous files (like training shards and checkpoints) need very few extents, which keeps metadata small and reads sequential.

$ filefrag -v bigfile.bin

Journaling

A journal records metadata changes before they're applied, so after a crash the filesystem replays or discards incomplete operations instead of running a full check. By default both ext4 (data=ordered) and XFS journal metadata, not file contents.

XFS vs ext4 (concept level)

ext4XFS
Inode allocationFixed at mkfs time (set by bytes-per-inode, mkfs.ext4 -i)Dynamic, up to a percentage of space (imaxpct)
ParallelismBlock groupsAllocation groups, designed for parallel I/O
ShrinkOffline shrink supportedCannot shrink
Typical useGeneral purpose, boot volumesLarge files, local NVMe scratch, many storage servers
$ xfs_info /data
$ sudo tune2fs -l /dev/sdb1 | grep -i inode

Tools

df -h / df -i
Space used vs inodes used. Check both.
stat FILE
Inode number, size, blocks, timestamps.
filefrag -v FILE
How many extents a file uses.
xfs_info MOUNT / tune2fs -l DEV
Filesystem geometry for XFS / ext4.

Quiz

Lab

Lab 1.3 · Disk full with free space

A preprocessing job on gpu-a dies with No space left on device when it creates files in /scratch, yet df -h shows the filesystem barely half full. The team already packed the loose image tiles into shards on Lustre at /lustre/datasets/tiles-shards, but never cleaned up.

Start lab 1.3 →

Try it now in the simulator (opens with the command ready; press Enter):

$ df -h$ df -i