最後更新: 2021-07-07
介紹
fsck 係一個 caller 來, 它會因應 file system 類型而 call 它的 backend
fsck - call -> fsck.ext3 -> fsck.ext4 -> fsck.xfs -> ...
Phases of fsck
Phase 1: Check Blocks and Sizes - checks inodes for inconsistencies
Phase 2: Check Path-Names - checks directory <-> inode consistencies
Phase 3: Check Connectivity - checks that all directories are connected to the file system
Phase 4: Check Reference Counts - compares link count information from Phases 2 & 3, correcting discrepancies
Phase 5: Check Cylinder Groups - checks free blocks and the used inode maps for consistency
Phase 6: Salvage Cylinder Groups - update the tables to reflect any changes made in earlier passes
Options
對於 fsck.ext3 (For some filesystem-specific checkers)而言
-z undo_file
Before overwriting a file system block, write the old contents of the block to an undo file.
This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong.
i.e.
/sbin/fsck.ext4 -z undo_file -b 98304 -B 4096 /dev/myraidvg/MyBackup_snap -y
Overwriting existing filesystem; this can be undone using the command:
e2undo undo_file /dev/myraidvg/MyBackup_snap
-p
Automatically fix any filesystem problems that can be safely fixed without human intervention.
If e2fsck discovers a problem which may require the system administrator to take additional corrective action,
e2fsck will print a description of the problem and then exit with the value 4 logically or'ed into the exit code.
-n
For some filesystem-specific checkers
avoid attempting to repair any problems (report such problems to stdout)