1xfs_scrub(8) System Manager's Manual xfs_scrub(8)
2
3
4
6 xfs_scrub - check and repair the contents of a mounted XFS filesystem
7
9 xfs_scrub [ -abCemnTvx ] mount-point
10 xfs_scrub -V
11
13 xfs_scrub attempts to check and repair all metadata in a mounted XFS
14 filesystem.
15
16 WARNING! This program is EXPERIMENTAL, which means that its behavior
17 and interface could change at any time!
18
19 xfs_scrub asks the kernel to scrub all metadata objects in the filesys‐
20 tem. Metadata records are scanned for obviously bad values and then
21 cross-referenced against other metadata. The goal is to establish a
22 reasonable confidence about the consistency of the overall filesystem
23 by examining the consistency of individual metadata records against the
24 other metadata in the filesystem. Damaged metadata can be rebuilt from
25 other metadata if there exists redundant data structures which are
26 intact.
27
28 Filesystem corruption and optimization opportunities will be logged to
29 the standard error stream. Enabling verbose mode will increase the
30 amount of status information sent to the output.
31
32 If the kernel scrub reports that metadata needs repairs or optimiza‐
33 tions and the user does not pass -n on the command line, this program
34 will ask the kernel to make the repairs and to perform the optimiza‐
35 tions. See the sections about optimizations and repairs for a list of
36 optimizations and repairs known to this program. The kernel may not
37 support repairing or optimizing the filesystem. If this is the case,
38 the filesystem must be unmounted and xfs_repair(8) run on the filesys‐
39 tem to fix the problems.
40
42 -a errors
43 Abort if more than this many errors are found on the filesystem.
44
45 -b Run in background mode. If the option is specified once, only
46 run a single scrubbing thread at a time. If given more than
47 once, an artificial delay of 100us is added to each scrub call
48 to reduce CPU overhead even further.
49
50 -C fd This option causes xfs_scrub to write progress information to
51 the specified file description so that the progress of the
52 filesystem check can be monitored. If the file description is a
53 tty, a fancy progress bar is rendered. Otherwise, a simple
54 numeric status dump compatible with the fsck -C format is out‐
55 put.
56
57 -e Specifies what happens when errors are detected. If shutdown is
58 given, the filesystem will be taken offline if errors are found.
59 If continue is given, no action is taken if errors are found;
60 this is the default behavior.
61
62 -k Do not call TRIM on the free space.
63
64 -m file
65 Search this file for mounted filesystems instead of /etc/mtab.
66
67 -n Only check filesystem metadata. Do not repair or optimize any‐
68 thing.
69
70 -T Print timing and memory usage information for each phase.
71
72 -v Enable verbose mode, which prints periodic status updates.
73
74 -V Prints the version number and exits.
75
76 -x Read all file data extents to look for disk errors. xfs_scrub
77 will issue O_DIRECT reads to the block device directly. If the
78 block device is a SCSI disk, it will instead issue READ VERIFY
79 commands directly to the disk. These actions will confirm that
80 all file data blocks can be read from storage.
81
83 Optimizations supported by this program include, but are not limited
84 to:
85
86 · Instructing the underlying storage to discard unused extents via the
87 TRIM ioctl.
88
89 · Updating secondary superblocks to match the primary superblock.
90
91 · Turning off shared block write checks for files that no longer share
92 blocks.
93
95 Repairs are performed by calling into the kernel. This limits the
96 scope of repair activities to rebuilding primary data structures from
97 secondary data structures, or secondary structures from primary struc‐
98 tures. The existence of secondary data structures may require features
99 that can only be turned on from mkfs.xfs(8). If errors cannot be
100 repaired, the filesystem must be unmounted and xfs_repair(8) run.
101 Repairs supported by the kernel include, but are not limited to:
102
103 · Reconstructing extent allocation data.
104
105 · Rebuilding free space information.
106
107 · Rebuilding inode indexes.
108
109 · Fixing minor corruptions of inode records.
110
111 · Recalculating reference count information.
112
113 · Reconstructing reverse mapping data from primary extent allocation
114 data.
115
116 · Scheduling a quotacheck for the next mount.
117
118 If corrupt metadata is successfully repaired, this program will log
119 that a repair has succeeded instead of a corruption report.
120
122 The exit code returned by xfs_scrub is the sum of the following condi‐
123 tions:
124 0 - No errors
125 1 - File system errors left uncorrected
126 2 - File system optimizations possible
127 4 - Operational error
128 8 - Usage or syntax error
129
131 xfs_scrub is an immature utility! Do not run this program unless you
132 have backups of your data! This program takes advantage of in-kernel
133 scrubbing to verify a given data structure with locks held and can keep
134 the filesystem busy for a long time. The kernel must be new enough to
135 support the SCRUB_METADATA ioctl.
136
137 If errors are found and cannot be repaired, the filesystem must be
138 unmounted and repaired.
139
141 xfs_repair(8).
142
143
144
145 xfs_scrub(8)