xfs_scrub(8) | System Manager's Manual | xfs_scrub(8) |
xfs_scrub - check and repair the contents of a mounted XFS filesystem
xfs_scrub [ -abCemnTvx ] mount-point
xfs_scrub -V
xfs_scrub attempts to check and repair all metadata in a mounted XFS filesystem.
WARNING! This program is EXPERIMENTAL, which means that its behavior and interface could change at any time!
xfs_scrub asks the kernel to scrub all metadata objects in the filesystem. Metadata records are scanned for obviously bad values and then cross-referenced against other metadata. The goal is to establish a reasonable confidence about the consistency of the overall filesystem by examining the consistency of individual metadata records against the other metadata in the filesystem. Damaged metadata can be rebuilt from other metadata if there exists redundant data structures which are intact.
Filesystem corruption and optimization opportunities will be logged to the standard error stream. Enabling verbose mode will increase the amount of status information sent to the output.
If the kernel scrub reports that metadata needs repairs or optimizations and the user does not pass -n on the command line, this program will ask the kernel to make the repairs and to perform the optimizations. See the sections about optimizations and repairs for a list of optimizations and repairs known to this program. The kernel may not support repairing or optimizing the filesystem. If this is the case, the filesystem must be unmounted and xfs_repair(8) run on the filesystem to fix the problems.
Optimizations supported by this program include, but are not limited to:
Repairs are performed by calling into the kernel. This limits the scope of repair activities to rebuilding primary data structures from secondary data structures, or secondary structures from primary structures. The existence of secondary data structures may require features that can only be turned on from mkfs.xfs(8). If errors cannot be repaired, the filesystem must be unmounted and xfs_repair(8) run. Repairs supported by the kernel include, but are not limited to:
If corrupt metadata is successfully repaired, this program will log that a repair has succeeded instead of a corruption report.
The exit code returned by xfs_scrub is the sum of the
following conditions:
0 - No errors
1 - File system errors left uncorrected
2 - File system optimizations possible
4 - Operational error
8 - Usage or syntax error
xfs_scrub is an immature utility! Do not run this program unless you have backups of your data! This program takes advantage of in-kernel scrubbing to verify a given data structure with locks held and can keep the filesystem busy for a long time. The kernel must be new enough to support the SCRUB_METADATA ioctl.
If errors are found and cannot be repaired, the filesystem must be unmounted and repaired.