LinuxCommandLibrary

xfs_check

Check XFS filesystem for errors

SYNOPSIS

xfs_check [ options ] device

PARAMETERS

device
    The block device name (e.g., /dev/sdb1) or XFS image file to check.

-f
    Specifies that the device is a regular file image, allowing `xfs_check` to operate on a disk image file instead of a block device.

-r
    Requests a read-only filesystem check. This option is typically redundant if the filesystem is already mounted read-only or unmounted.

-s
    Specifies that the filesystem is a SCSI device. This option is often not necessary as the kernel usually handles device type detection automatically.

-v
    Enables verbose output, providing more details about the check process and detected inconsistencies.

-l logdev
    Specifies the device where the external log resides for filesystems configured with a separate log device.

-L loglen
    Specifies the length of the external log in filesystem blocks. This is used in conjunction with `-l`.

DESCRIPTION

xfs_check is a utility designed to perform consistency checks on an XFS filesystem. It examines the filesystem's metadata to identify potential corruption or inconsistencies without attempting to repair them. Its primary purpose is to report on the health of the filesystem.

It's important to note that xfs_check has been largely superseded by the `xfs_repair` utility. For a non-destructive check that simulates a repair, users are strongly advised to use `xfs_repair -n` instead, as `xfs_check` often provides less detailed or actionable information and may not detect all issues that `xfs_repair -n` would.

The command should typically be run on a filesystem that is unmounted or mounted in a read-only state to prevent further corruption during the check. It does not modify the filesystem in any way.

CAVEATS

xfs_check is largely deprecated. The recommended approach for checking an XFS filesystem for errors without modifying it is to use the command `xfs_repair -n`. This provides a more comprehensive dry run of a potential repair, detecting a wider range of issues.

Crucially, xfs_check does not perform any repairs; it only reports detected inconsistencies. To ensure data integrity, the filesystem should be unmounted or mounted read-only before running this command or `xfs_repair -n`. Running it on a mounted, writable filesystem can lead to data corruption.

ALTERNATIVE FOR CHECKING

For a more reliable and detailed check of an XFS filesystem without making any modifications, use `xfs_repair -n device`. This command simulates a full repair and reports all issues it would fix, providing a more accurate assessment of the filesystem's health compared to `xfs_check`.

HISTORY

xfs_check is part of the XFS filesystem utilities, which were originally developed by Silicon Graphics, Inc. (SGI). While it has existed as a tool for checking XFS filesystem consistency for a long time, its utility has diminished over time as the `xfs_repair` tool evolved to include more robust checking capabilities, particularly its non-destructive "dry run" mode (`-n`). Therefore, its usage has become less common, with `xfs_repair -n` now being the preferred method for pre-repair checks.

SEE ALSO

xfs_repair(8), xfs(5), mkfs.xfs(8), mount(8)

Copied to clipboard