11.2. Filesystem-Specific Information for fsck
11.2.1. ext2, ext3, and ext4
e2fsckbinary to perform filesystem checks and repairs. The filenames
fsck.ext4are hardlinks to this same binary. These binaries are run automatically at boot time and their behavior differs based on the filesystem being checked and the state of the filesystem.
e2fsckfinds that a filesystem is marked with such an error
e2fsckwill perform a full check after replaying the journal (if present).
e2fsckmay ask for user input during the run if the
-poption is not specified. The
e2fsckto automatically do all repairs that may be done safely. If user intervention is required,
e2fsckwill indicate the unfixed problem in its output and reflect this status in the exit code.
e2fsckrun-time options include:
- No-modify mode. Check-only operation.
- Specify block number of an alternate suprerblock if the primary one is damaged.
- Force full check even if the superblock has no recorded errors.
- Specify the external journal device, if any.
- Automatically repair or "preen" the filesystem with no user input.
- Assume an answer of "yes" to all questions.
e2fsckare specified in the
- Inode, block, and size checks.
- Directory structure checks.
- Directory connectivity checks.
- Reference count checks.
- Group summary info checks.
e2image(8)utility can be used to create a metadata image prior to repair for diagnostic or testing purposes. The
-roption should be used for testing purposes in order to create a sparse file of the same size as the filesystem itself.
e2fsckcan then operate directly on the resulting file. The
-Qoption should be specified if the image is to be archived or provided for diagnostic. This creates a more compact file format suitable for transfer.
xfs_repairtool is used.
fsck.xfsbinary is present in the xfsprogs package, this is present only to satisfy initscripts that look for an
fsck.filesystembinary at boot time.
fsck.xfsimmediately exits with an exit code of 0.
xfs_checktool. This tool is very slow and does not scale well for large filesystems. As such, it has been depreciated in favor of
xfs_repairto operate. If the filesystem was not cleanly unmounted, it should be mounted and unmounted prior to using
xfs_repair. If the log is corrupt and cannot be replayed, the
-Loption may be used to zero the log.
-Loption must only be used if the log cannot be replayed. The option discards all metadata updates in the log and will result in further inconsistencies.
xfs_repairin a dry run, check-only mode by using the
-noption. No changes will be made to the filesystem when this option is specified.
xfs_repairtakes very few options. Commonly used options include:
- No modify mode. Check-only operation.
- Zero metadata log. Use only if log cannot be replayed with mount.
- Limit memory used during run to maxmem MB. 0 can be specified to obtain a rough estimate of the minimum memory required.
- Specify the external log device, if present.
xfs_repairare specified in the
- Inode and inode blockmap (addressing) checks.
- Inode allocation map checks.
- Inode size checks.
- Directory checks.
- Pathname checks.
- Link count checks.
- Freemap checks.
- Super block checks.
xfs_repairis not interactive. All operations are performed automatically with no input from the user.
xfs_mdrestore(8)utilities may be used.
btrfscktool is used to check and repair btrfs filesystems. This tool is still in early development and may not detect or repair all types of filesystem corruption.
btrfsckdoes not make changes to the filesystem; that is, it runs check-only mode by default. If repairs are desired the
--repairoption must be specified.
- Extent checks.
- Filesystem root checks.
- Root reference count checks.
btrfs-image(8)utility can be used to create a metadata image prior to repair for diagnostic or testing purposes.