Chapter 13: File Systems and Crash Recovery
Vol 3: Computer Core Expedition · Chapter 13
Metadata Card
| Attribute | Value |
|---|---|
| Keywords | Journaling, LFS, RAID, ACL, Crash Consistency |
Your Progress
"Files are the most persistent abstraction in computing. But what happens when the system crashes in the middle of a file write? The file system must ensure it doesn't leave data in an inconsistent state."
Encounter 1: File System Structure
Super block → Inode table → Data blocks
↓
Disk layout metadata- Inode: Metadata for a file (permissions, size, data block pointers)
- Directory: Maps filenames to inode numbers
Encounter 2: Crash Consistency Problem
When writing a file, multiple disk operations are needed (update inode, update data block, update directory). A crash between any two operations can leave the file system in an inconsistent state.
Encounter 3: Journaling (Write-ahead Logging)
- Write the entire operation to a journal (log)
- Once the journal entry is safely written, apply the operation to the actual file system
- After applying, mark the journal entry as complete (checkpoint)
On crash recovery: replay the journal to apply or discard incomplete operations.
EXT3/EXT4: Most common journaling file systems on Linux.
Encounter 4: LFS (Log-Structured File System)
Treats the entire disk as a log — all writes go to the end of the log. Improves write performance (sequential instead of random) but requires garbage collection.
Verification Checklist
- [ ] Can describe the basic file system structure
- [ ] Can explain the crash consistency problem
- [ ] Can describe how journaling solves crash consistency
- [ ] Can explain the basic idea of LFS
→ Next Stop Preview
Chapter 14: Virtualization and Containers