1BTRFS-SCRUB(8)                       BTRFS                      BTRFS-SCRUB(8)
2
3
4

NAME

6       btrfs-scrub - scrub btrfs filesystem, verify block checksums
7

SYNOPSIS

9       btrfs scrub <subcommand> <args>
10

DESCRIPTION

12       Scrub is a pass over all filesystem data and metadata and verifying the
13       checksums. If a valid copy is available (replicated  block  group  pro‐
14       files)  then  the damaged one is repaired. All copies of the replicated
15       profiles are validated.
16
17       NOTE:
18          Scrub is not a filesystem checker (fsck) and does not verify nor re‐
19          pair  structural  damage  in  the  filesystem. It really only checks
20          checksums of data and tree blocks, it doesn't ensure the content  of
21          tree  blocks  is  valid and consistent. There's some validation per‐
22          formed when metadata blocks are read from disk but it's  not  exten‐
23          sive and cannot substitute full btrfs check run.
24
25       The  user  is supposed to run it manually or via a periodic system ser‐
26       vice. The recommended period is a month but could be  less.  The  esti‐
27       mated  device bandwidth utilization is about 80% on an idle filesystem.
28       The IO priority class is by default idle so background scrub should not
29       significantly interfere with normal filesystem operation. The IO sched‐
30       uler set for the device(s)  might  not  support  the  priority  classes
31       though.
32
33       The  scrubbing  status  is recorded in /var/lib/btrfs/ in textual files
34       named scrub.status.UUID for a filesystem identified by the given  UUID.
35       (Progress   state   is  communicated  through  a  named  pipe  in  file
36       scrub.progress.UUID in the same directory.) The status file is  updated
37       every  5 seconds. A resumed scrub will continue from the last saved po‐
38       sition.
39
40       Scrub can be started only on a mounted filesystem, though it's possible
41       to scrub only a selected device. See btrfs scrub start for more.
42

SUBCOMMAND

44       cancel <path>|<device>
45              If  a  scrub  is running on the filesystem identified by path or
46              device, cancel it.
47
48              If a device is specified, the corresponding filesystem is  found
49              and  btrfs  scrub  cancel  behaves  as  if it was called on that
50              filesystem.  The progress is saved in the status file  so  btrfs
51              scrub resume can continue from the last position.
52
53       resume  [-BdqrR]  [-c <ioprio_class> -n <ioprio_classdata>] <path>|<de‐
54       vice>
55              Resume a cancelled or interrupted scrub on the filesystem  iden‐
56              tified  by path or on a given device. The starting point is read
57              from the status file if it exists.
58
59              This does not start a new scrub if the last scrub finished  suc‐
60              cessfully.
61
62              Options
63
64              see scrub start.
65
66       start  [-BdqrRf]  [-c <ioprio_class> -n <ioprio_classdata>] <path>|<de‐
67       vice>
68              Start a scrub on all devices of the mounted  filesystem  identi‐
69              fied  by  path or on a single device. If a scrub is already run‐
70              ning, the new one will not  start.  A  device  of  an  unmounted
71              filesystem cannot be scrubbed this way.
72
73              Without  options,  scrub is started as a background process. The
74              automatic repairs of damaged copies is performed by default  for
75              block group profiles with redundancy.
76
77              The default IO priority of scrub is the idle class. The priority
78              can be configured similar to the ionice(1) syntax using  -c  and
79              -n  options.   Note  that not all IO schedulers honor the ionice
80              settings.
81
82              Options
83
84              -B     do not background and print scrub  statistics  when  fin‐
85                     ished
86
87              -d     print separate statistics for each device of the filesys‐
88                     tem (-B only) at the end
89
90              -r     run in read-only mode, do not  attempt  to  correct  any‐
91                     thing, can be run on a read-only filesystem
92
93              -R     raw print mode, print full data instead of summary
94
95              -c <ioprio_class>
96                     set IO priority class (see ionice(1) manpage)
97
98              -n <ioprio_classdata>
99                     set IO priority classdata (see ionice(1) manpage)
100
101              -f     force  starting new scrub even if a scrub is already run‐
102                     ning, this can useful when scrub status file  is  damaged
103                     and  reports  a  running  scrub  although  it is not, but
104                     should not normally be necessary
105
106              -q     (deprecated) alias for global -q option
107
108       status [options] <path>|<device>
109              Show status of a running scrub for the filesystem identified  by
110              path or for the specified device.
111
112              If  no scrub is running, show statistics of the last finished or
113              cancelled scrub for that filesystem or device.
114
115              Options
116
117              -d     print separate statistics for each device of the filesys‐
118                     tem
119
120              -R     print  all  raw  statistics without postprocessing as re‐
121                     turned by the status ioctl
122
123              --raw  print all numbers raw values in bytes without the B  suf‐
124                     fix
125
126              --human-readable
127                     print  human friendly numbers, base 1024, this is the de‐
128                     fault
129
130              --iec  select the 1024 base for the following options, according
131                     to the IEC standard
132
133              --si   select the 1000 base for the following options, according
134                     to the SI standard
135
136              --kbytes
137                     show sizes in KiB, or kB with --si
138
139              --mbytes
140                     show sizes in MiB, or MB with --si
141
142              --gbytes
143                     show sizes in GiB, or GB with --si
144
145              --tbytes
146                     show sizes in TiB, or TB with --si
147

EXIT STATUS

149       btrfs scrub returns a zero exit status if it succeeds. Non zero is  re‐
150       turned in case of failure:
151
152       1      scrub couldn't be performed
153
154       2      there is nothing to resume
155
156       3      scrub found uncorrectable errors
157

AVAILABILITY

159       btrfs  is  part  of  btrfs-progs.   Please  refer  to  the  btrfs  wiki
160       http://btrfs.wiki.kernel.org for further details.
161

SEE ALSO

163       mkfs.btrfs(8), ionice(1)
164
166       2022
167
168
169
170
1715.18                             May 25, 2022                   BTRFS-SCRUB(8)
Impressum