File systems: implementation, journaling
Operating Systems · Engineering
Study notes
Writing a file on ext4: the journal first records 'allocate blocks 100-105, update inode 42' as one transaction and commits it. If power fails mid-write, recovery replays the journal: the file is either fully written or absent, never half-corrupt. Without journaling, fsck would scan the whole disk guessing.