Home / Alt manpages / xfs_scrub_all(8)

  • xfs_scrub_all(8)
  • Admin command
  • linux

Scrub Every Mounted XFS Filesystem with xfs_scrub_all

xfs_scrub_all checks every mounted XFS filesystem, records a meaningful exit status, and tells you when to stop for a separate repair procedure. Allow 10 to 30 minutes for a small or quiet host. Large filesystems, busy storage and full data reads can take much longer.

This guide describes xfsprogs 6.6.0, installed on the system used for these examples. The command checks mounted filesystems only. It does not scan an unmounted XFS volume or discover one merely because it exists in /etc/fstab.

1. Check the installed command

Start without changing anything. The version check is an ordinary, unprivileged command:

$ command -v xfs_scrub_all
/usr/sbin/xfs_scrub_all
$ xfs_scrub_all -V
xfs_scrub_all version 6.6.0
$ xfs_scrub_all -h
usage: xfs_scrub_all [-h] [-V]

Your help text may include the description and option details on additional lines. The important boundary is small: this wrapper offers only help and version options. It has no option for selecting one mount point, suppressing repair, or changing the scan policy.

Checkpoint

If the command is missing, stop here and install or repair the xfsprogs package through your normal system-management process. Do not copy a binary from another host.

2. List the XFS filesystems that will be affected

Inspect the current mounts before invoking the scrubber. This is read-only and does not need sudo:

$ findmnt -t xfs -o TARGET,SOURCE,FSTYPE,OPTIONS
TARGET  SOURCE              FSTYPE OPTIONS
/data   /dev/mapper/vg-data xfs    rw,relatime

The target list is host-specific. If it is empty, there is no mounted XFS filesystem for xfs_scrub_all to process. On a host with no XFS mounts, the installed command returned status 0 and printed no output. That result means no errors were reported by this invocation; it is not evidence that an unmounted filesystem was checked.

Look for storage that is about to be backed up, migrated or deliberately taken offline. Scrubbing can keep a filesystem busy for a long time. Schedule it so the extra I/O and CPU work do not collide with a maintenance window or a latency-sensitive workload.

3. Understand the repair boundary

xfs_scrub_all runs the online xfs_scrub operation for each mounted XFS filesystem. The underlying tool checks metadata and can ask the kernel to repair or optimise supported problems when the command is not given -n. The all-filesystems wrapper does not expose -n, so treat the operation as potentially corrective, not as a read-only report.

This is the main safety checkpoint. Before running it, make sure the host has a current, restorable backup and that you understand which mounts are in scope. Do not use it as a substitute for testing a backup. The XFS manual describes the utility as experimental and warns that it can keep a filesystem busy.

If you require a metadata check with repair and optimisation disabled, use the separately reviewed xfs_scrub -n MOUNT_POINT workflow instead of trying to pass an invented option to xfs_scrub_all. Check that tool's installed manual page and choose the mount point explicitly.

4. Run the scrub

Run the all-filesystems command with elevated privileges when the host's permissions require it. The command may use xfs_scrub directly or systemd to start it in a restricted fashion, according to the installed implementation:

$ sudo xfs_scrub_all
$ status=$?
$ printf 'xfs_scrub_all exit status: %s\n' "$status"
xfs_scrub_all exit status: 0

Do not assume that a quiet terminal means the scan is finished or that every filesystem was healthy. Some status and error information is written by the underlying scrubber to standard error, and the amount of progress output depends on how it is started. Wait for the shell prompt before recording the result.

The command maps mounted filesystems to physical devices and can scrub in parallel when two jobs will not access the same device. That can shorten a run, but it does not make a busy or fragile storage system risk-free. Keep an eye on the host's normal monitoring and stop escalating if storage latency or other service symptoms become unacceptable.

5. Interpret the exit status

The wrapper returns a sum of condition values. A status can therefore contain more than one condition:

ValueMeaningNext action
0No errorsRecord the mounts checked and the time.
4Filesystem errors left uncorrectedPreserve the diagnostic output and investigate the affected filesystem.
8Operational errorCheck permissions, mount state, kernel support and service logs.
16Usage or syntax errorReview the command and installed version.

For example, status 12 means an operational error and filesystem errors left uncorrected. Test a value with shell arithmetic rather than relying on a single label:

$ status=12
$ (( status & 4 )) && echo 'uncorrected filesystem errors reported'
uncorrected filesystem errors reported
$ (( status & 8 )) && echo 'operational error reported'
operational error reported

That example only decodes a saved value. Use the status printed by the real command and retain the complete terminal output for incident notes.

6. Investigate a non-zero result

Do not immediately rerun a failing scrub in a loop. First identify which mount produced the diagnostic, check the kernel and service logs, and confirm that the filesystem is still mounted:

$ findmnt -t xfs -o TARGET,SOURCE,FSTYPE,OPTIONS
$ journalctl -b --no-pager | grep -iE 'xfs|scrub'
$ dmesg --level=err,warn | grep -i xfs

Some systems restrict access to the kernel log or journal. Add sudo only to the individual command that needs it. Preserve the original output before filtering it, because a grep pattern can hide useful context.

A scrub report that says metadata cannot be repaired is not fixed by another wrapper invocation. The installed xfs_scrub documentation directs you towards unmounting the filesystem and using xfs_repair when online repair cannot resolve the problem. That is a service-disrupting recovery operation: stop, confirm backups, plan downtime and follow the recovery procedure for the host. Do not unmount a live service mount as an improvised next step.

Done means

  • You checked the installed xfsprogs version and confirmed the command's limited option set.
  • You listed mounted XFS filesystems before running the scan.
  • You understood that xfs_scrub_all can invoke corrective online scrub behaviour.
  • You ran it with appropriate privileges and waited for its final exit status.
  • You recorded the status, diagnostics and mounts in scope.
  • You have a deliberate recovery plan for uncorrected errors instead of repeatedly rerunning the scrub.