1xfs_scrub(8)                System Manager's Manual               xfs_scrub(8)
2
3
4

NAME

6       xfs_scrub - check and repair the contents of a mounted XFS filesystem
7

SYNOPSIS

9       xfs_scrub [ -abCemnTvx ] mount-point
10       xfs_scrub -V
11

DESCRIPTION

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

OPTIONS

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.  If media errors are  found,  the
80              error  report  will  include  the disk offset, in bytes.  If the
81              media errors affect a file, the report  will  also  include  the
82              inode number and file offset, in bytes.  These actions will con‐
83              firm that all file data blocks can be read from storage.
84

OPTIMIZATIONS

86       Optimizations supported by this program include, but  are  not  limited
87       to:
88
89       · Instructing  the underlying storage to discard unused extents via the
90         TRIM ioctl.
91
92       · Updating secondary superblocks to match the primary superblock.
93
94       · Turning off shared block write checks for files that no longer  share
95         blocks.
96

REPAIRS

98       Repairs  are  performed  by  calling  into the kernel.  This limits the
99       scope of repair activities to rebuilding primary data  structures  from
100       secondary  data structures, or secondary structures from primary struc‐
101       tures.  The existence of secondary data structures may require features
102       that  can  only  be  turned  on  from mkfs.xfs(8).  If errors cannot be
103       repaired, the filesystem  must  be  unmounted  and  xfs_repair(8)  run.
104       Repairs supported by the kernel include, but are not limited to:
105
106       · Reconstructing extent allocation data.
107
108       · Rebuilding free space information.
109
110       · Rebuilding inode indexes.
111
112       · Fixing minor corruptions of inode records.
113
114       · Recalculating reference count information.
115
116       · Reconstructing  reverse  mapping  data from primary extent allocation
117         data.
118
119       · Scheduling a quotacheck for the next mount.
120
121       If corrupt metadata is successfully repaired,  this  program  will  log
122       that a repair has succeeded instead of a corruption report.
123

EXIT CODE

125       The  exit code returned by xfs_scrub is the sum of the following condi‐
126       tions:
127            0    - No errors
128            1    - File system errors left uncorrected
129            2    - File system optimizations possible
130            4    - Operational error
131            8    - Usage or syntax error
132

CAVEATS

134       xfs_scrub is an immature utility!  Do not run this program  unless  you
135       have  backups  of your data!  This program takes advantage of in-kernel
136       scrubbing to verify a given data structure with locks held and can keep
137       the  filesystem busy for a long time.  The kernel must be new enough to
138       support the SCRUB_METADATA ioctl.
139
140       If errors are found and cannot be  repaired,  the  filesystem  must  be
141       unmounted and repaired.
142

SEE ALSO

144       xfs_repair(8).
145
146
147
148                                                                  xfs_scrub(8)
Impressum