Consistency Checking

Consistency checking 是傳統 crash recovery:允許 metadata crash 後不一致,reboot 時用 checker 掃描 file system 並修補。UNIX 典型工具是 fsck


What It Checks

Checker 比對 directory、FCB/inode table、free-block map、free-FCB list 等是否描述同一狀態。

常見問題:

  • block 被兩個 files 引用。
  • block 不屬於任何 file,也不在 free list / bitmap。
  • directory entry 指向不存在或已釋放 inode。
  • inode 已配置但沒有 directory entry。
  • free count 與實際數量不符。

Optimizations and Limits

  • status bit:metadata update 前標成 in flux;成功後標 clean。Reboot 若 clean 可跳過完整 scan。
  • repair limit:checker 常能讓 file system 結構可用,但不保證所有 user data 都完整。孤兒 inodes/blocks 可能被放到 lost+found。
  • sync metadata writes:可縮小 crash window,但不能完全消除 partial write / device cache 問題。

Tradeoff

Fsck-style recovery 簡單、不需 journal;但 large storage scan 可能花很久,且某些 corruption 需人工處理。因此大型 production file systems 多搭配 D-OS-Ch14gb-Journaling_File_SystemD-OS-Ch14gc-Copy_on_Write_File_System