Checking and Repairing an XFS File System
Use the xfs_repair
command to check file system consistency and to
perform a file system repair.
If you can't mount an XFS file system, you can use the xfs_repair
command
to check its consistency and repair any issues. The command replays the journal log and
shows any inconsistencies that might have resulted from the file system not being cleanly
unmounted. Unless the file system has an inconsistency, you don't need to perform any
repairs, as the journal is replayed every time that you mount an XFS file system.
The following procedure provides the usual steps to take when checking and repairing a file system with a corrupted journal.
If you can't mount the file system or you don't have a suitable backup, running the
xfs_repair
command is the only viable option, unless you're experienced
in using the xfs_db
command.
xfs_db
provides an internal command set for debugging and repairing an
XFS file system manually. The commands enable you to perform scans on the file system, and
display its data structures. If you specify the -x
option to enable
expert mode, you can change the data structures.
sudo xfs_db [-x] device
For more information, see the xfs_db(8)
and
xfs_repair(8)
manual pages, and run the help
command
within xfs_db
.