Names, inodes and blocks
In ext4, distinguish a directory entry’s name from the inode it identifies and from the blocks holding the file’s data. A hard link adds another name for an inode rather than copying the complete file contents. The filesystem is divided into block groups, and allocation policies try to keep related information near one another. Renaming a path, changing a file’s length and overwriting data affect different structures. A pathname is therefore not a physical storage address. Following the successive mappings is more useful than picturing a file as one immutable run of disk sectors.
Work an extent mapping
With extent-based mapping, a consecutive logical range maps to a consecutive physical range. For example, logical blocks zero through ninety-nine can map to physical blocks one thousand through one thousand ninety-nine. One extent can describe that run more compactly than a list of one hundred independent block addresses. Growth and fragmentation can require additional extents, however. Logical file size also differs from allocated storage: sparse regions and unwritten extents complicate the relation. A large apparent size is not sufficient evidence that the same quantity of physical data blocks has been allocated and written.
Understand the recovery boundary
The journal supports recovery of filesystem updates after interruption, but metadata consistency is not the same guarantee as preserving every application’s latest data. Modes such as data=ordered impose particular ordering relationships, and different modes change the discussion. Returning from a write can mean that data has reached the kernel’s memory rather than durable media. Application durability depends on the synchronization operations used and on the behavior promised by the filesystem and storage device. State these conditions before drawing conclusions from a crash experiment or comparing performance across mount configurations.
Check replacement and recovery assumptions
A replacement-save pattern might write a temporary file, synchronize it and rename it over the destination. The persistence of file contents and the persistence of directory changes are separate concerns. Atomic name replacement alone does not establish every post-power-loss state; directory synchronization and platform guarantees matter. Inspect free blocks, inode availability, link counts and mount configuration when diagnosing failures. A journal also does not replace backups against accidental deletion or device loss. A recovery claim should identify the failure being considered and the persistent state that is expected to survive it.