12.2.2. XFS
No repair is performed automatically at boot time. To initiate a filesystem check or repair, the
xfs_repair
tool is used.
Note
Although an
fsck.xfs
binary is present in the xfsprogs package, this is present only to satisfy initscripts that look for an fsck.filesystem
binary at boot time. fsck.xfs
immediately exits with an exit code of 0.
Another thing to be aware of is that older xfsprogs packages contain an
xfs_check
tool. This tool is very slow and does not scale well for large filesystems. As such, it has been depreciated in favor of xfs_repair -n
.
A clean log on a filesystem is required for
xfs_repair
to 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 -L
option may be used to zero the log.
Important
The
-L
option 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.
It is possible to run
xfs_repair
in a dry run, check-only mode by using the -n
option. No changes will be made to the filesystem when this option is specified.
xfs_repair
takes very few options. Commonly used options include:
-n
- No modify mode. Check-only operation.
-L
- Zero metadata log. Use only if log cannot be replayed with mount.
-m
maxmem- Limit memory used during run to maxmem MB. 0 can be specified to obtain a rough estimate of the minimum memory required.
-l
logdev- Specify the external log device, if present.
All options for
xfs_repair
are specified in the xfs_repair(8)
manual page.
The following eight basic phases are performed by
xfs_repair
while running:
- Inode and inode blockmap (addressing) checks.
- Inode allocation map checks.
- Inode size checks.
- Directory checks.
- Pathname checks.
- Link count checks.
- Freemap checks.
- Superblock checks.
These phases, as well as messages printed during operation, are documented in depth in the
xfs_repair(8)
manual page.
xfs_repair
is not interactive. All operations are performed automatically with no input from the user.
If it is desired to create a metadata image prior to repair for diagnostic or testing purposes, the
xfs_metadump(8)
and xfs_mdrestore(8)
utilities may be used.