Crash Consistency: Ensure file system is recoverable after crash

Consistent State: Failure atomicity. Either look like nothing happened, or operations completed.

Approaches

Journaling Issues

FSCK

  1. Superblocks: Restore from another dup if corrupted
  2. Free blocks: Scan inodes, build in-memory bitmap, compare with fs bitmap
  3. Inode state: Check inode fields for corruption (if corrupted, remove inode)
  4. Inode links: Verify link count by traversing directory tree (if orphaned, move to lost+found)
  5. Duplicates: Check if two inodes refer to the same block (make copy of the block)
  6. Bad blocks: Bad pointers outside of valid range (remove)
  7. Directory checks: Make sure . and .. exist & directories are linked only once (prevent cycle)