{
    "mode": "man",
    "parameter": "xfs_scrub",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/xfs_scrub/8/json",
    "generated": "2026-06-15T14:27:33Z",
    "synopsis": "xfsscrub [ -abCemnTvx ] mount-point\nxfsscrub -V",
    "sections": {
        "NAME": {
            "content": "xfsscrub - check and repair the contents of a mounted XFS filesystem\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "xfsscrub [ -abCemnTvx ] mount-point\nxfsscrub -V\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "xfsscrub attempts to check and repair all metadata in a mounted XFS filesystem.\n\nWARNING!   This  program  is  EXPERIMENTAL, which means that its behavior and interface could\nchange at any time!\n\nxfsscrub asks the kernel to scrub all metadata objects in the filesystem.  Metadata  records\nare  scanned  for obviously bad values and then cross-referenced against other metadata.  The\ngoal is to establish a reasonable confidence about the consistency of the overall  filesystem\nby examining the consistency of individual metadata records against the other metadata in the\nfilesystem.  Damaged metadata can be rebuilt from other metadata if  there  exists  redundant\ndata structures which are intact.\n\nFilesystem  corruption  and  optimization  opportunities will be logged to the standard error\nstream.  Enabling verbose mode will increase the amount of status  information  sent  to  the\noutput.\n\nIf  the  kernel  scrub reports that metadata needs repairs or optimizations and the user does\nnot pass -n on the command line, this program will ask the kernel to make the repairs and  to\nperform  the  optimizations.   See the sections about optimizations and repairs for a list of\noptimizations and repairs known to this program.  The kernel may not support repairing or op‐\ntimizing  the  filesystem.  If this is the case, the filesystem must be unmounted and xfsre‐‐\npair(8) run on the filesystem to fix the problems.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-a",
                    "content": "Abort if more than this many errors are found on the filesystem.\n",
                    "flag": "-a"
                },
                {
                    "name": "-b",
                    "content": "thread  at  a time.  If given more than once, an artificial delay of 100us is added to\neach scrub call to reduce CPU overhead even further.\n",
                    "flag": "-b"
                },
                {
                    "name": "-C",
                    "content": "scription  so that the progress of the filesystem check can be monitored.  If the file\ndescription is a tty, a fancy progress bar is rendered.  Otherwise, a  simple  numeric\nstatus dump compatible with the fsck -C format is output.\n",
                    "flag": "-C"
                },
                {
                    "name": "-e",
                    "content": "will be taken offline if errors are found.  If continue is given, no action  is  taken\nif errors are found; this is the default behavior.\n",
                    "flag": "-e"
                },
                {
                    "name": "-k",
                    "content": "",
                    "flag": "-k"
                },
                {
                    "name": "-m",
                    "content": "Search this file for mounted filesystems instead of /etc/mtab.\n",
                    "flag": "-m"
                },
                {
                    "name": "-n",
                    "content": "",
                    "flag": "-n"
                },
                {
                    "name": "-T",
                    "content": "",
                    "flag": "-T"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                },
                {
                    "name": "-V",
                    "content": "",
                    "flag": "-V"
                },
                {
                    "name": "-x",
                    "content": "reads to the block device directly.  If the block device is a SCSI disk, it  will  in‐\nstead issue READ VERIFY commands directly to the disk.  If media errors are found, the\nerror report will include the disk offset, in bytes.  If the  media  errors  affect  a\nfile,  the report will also include the inode number and file offset, in bytes.  These\nactions will confirm that all file data blocks can be read from storage.\n",
                    "flag": "-x"
                }
            ]
        },
        "OPTIMIZATIONS": {
            "content": "Optimizations supported by this program include, but are not limited to:\n\n• Instructing the underlying storage to discard unused extents via the TRIM ioctl.\n\n• Updating secondary superblocks to match the primary superblock.\n\n• Turning off shared block write checks for files that no longer share blocks.\n",
            "subsections": []
        },
        "REPAIRS": {
            "content": "Repairs are performed by calling into the kernel.  This limits the scope of repair activities\nto rebuilding primary data structures from secondary data structures, or secondary structures\nfrom primary structures.  The existence of secondary data  structures  may  require  features\nthat  can  only  be turned on from mkfs.xfs(8).  If errors cannot be repaired, the filesystem\nmust be unmounted and xfsrepair(8) run.  Repairs supported by the kernel  include,  but  are\nnot limited to:\n\n• Reconstructing extent allocation data.\n\n• Rebuilding free space information.\n\n• Rebuilding inode indexes.\n\n• Fixing minor corruptions of inode records.\n\n• Recalculating reference count information.\n\n• Reconstructing reverse mapping data from primary extent allocation data.\n\n• Scheduling a quotacheck for the next mount.\n\nIf  corrupt  metadata  is successfully repaired, this program will log that a repair has suc‐\nceeded instead of a corruption report.\n",
            "subsections": []
        },
        "EXIT CODE": {
            "content": "The exit code returned by xfsscrub is the sum of the following conditions:\n0    - No errors\n1    - File system errors left uncorrected\n2    - File system optimizations possible\n4    - Operational error\n8    - Usage or syntax error\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "xfsscrub is an immature utility!  Do not run this program unless you have  backups  of  your\ndata!   This  program takes advantage of in-kernel scrubbing to verify a given data structure\nwith locks held and can keep the filesystem busy for a long time.  The  kernel  must  be  new\nenough to support the SCRUBMETADATA ioctl.\n\nIf errors are found and cannot be repaired, the filesystem must be unmounted and repaired.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "xfsrepair(8).\n\n\n\nxfsscrub(8)",
            "subsections": []
        }
    },
    "summary": "xfsscrub - check and repair the contents of a mounted XFS filesystem",
    "flags": [
        {
            "flag": "-a",
            "long": null,
            "arg": null,
            "description": "Abort if more than this many errors are found on the filesystem."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "thread at a time. If given more than once, an artificial delay of 100us is added to each scrub call to reduce CPU overhead even further."
        },
        {
            "flag": "-C",
            "long": null,
            "arg": null,
            "description": "scription so that the progress of the filesystem check can be monitored. If the file description is a tty, a fancy progress bar is rendered. Otherwise, a simple numeric status dump compatible with the fsck -C format is output."
        },
        {
            "flag": "-e",
            "long": null,
            "arg": null,
            "description": "will be taken offline if errors are found. If continue is given, no action is taken if errors are found; this is the default behavior."
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": "Search this file for mounted filesystems instead of /etc/mtab."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-T",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "reads to the block device directly. If the block device is a SCSI disk, it will in‐ stead issue READ VERIFY commands directly to the disk. If media errors are found, the error report will include the disk offset, in bytes. If the media errors affect a file, the report will also include the inode number and file offset, in bytes. These actions will confirm that all file data blocks can be read from storage."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "xfsrepair",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/xfsrepair/8/json"
        },
        {
            "name": "xfsscrub",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/xfsscrub/8/json"
        }
    ]
}