Running repairs on XFS Filesystems

The XFS File system is a high-performance journaling file system. XFS supports a maximum file system size of 500 TB and a maximum file size of 16 TB. You can create an XFS file system on a regular disk partition and on a logical volume. It performs incredibly well under a heavy load and scales with large files, but as a result, it is also susceptible to damage, and it is with this in mind that we now consider a set of tools that will enable us to troubleshoot the server and restore the filesystem.

Additional XFS utilities are available to perform file system maintenance. These utilities include the following:

xfs_fsr: XFS is an extent-based file system. The xfs_fsr utility reorganizes and improves the layout of the file extents, which improves overall performance. Run this command on a mounted XFS file system or on individual files in the file system.

xfs_repair: Repair a corrupted or damaged XFS file system. Unmount the file system before running this command. If the file system cannot be repaired, restore files from a backup with xfsrestore.

xfs_db: Debug an XFS file system. This utility provides a command set that allows you to perform scans on the file system and to navigate and display its data structures.

Repair a XFS filesystem using xfs_repair

The xfs_repair utility can be used to repair a corrupted or damaged XFS file system. The basic syntax used by xfs_repair is as follows:

# xfs_repair /mount/point

NOTE: Make sure you umount the XFS filesystem first before running the xfs_repair command.

Similar to the fsck utility, the xfs_repair utility fixes unmounted xfs filesystems in series of phases. Sample output from an XFS repair is as shown below:

You can alsu use the “xfs_repair -n” command to do a dry run for xfs_repair. Some distributions does not include the xfs_check command. In that case you can use this option as they work in the same way.