1BTRFS-SCRUB(8)                   Btrfs Manual                   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       btrfs scrub is used to scrub a mounted btrfs filesystem, which will
13       read all data and metadata blocks from all devices and verify
14       checksums. Automatically repair corrupted blocks if there’s a correct
15       copy available.
16
17           Note
18           Scrub is not a filesystem checker (fsck) and does not verify nor
19           repair 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
22           performed when metadata blocks are read from disk but it’s not
23           extensive and cannot substitute full btrfs check run.
24
25       The user is supposed to run it manually or via a periodic system
26       service. The recommended period is a month but could be less. The
27       estimated device bandwidth utilization is about 80% on an idle
28       filesystem. The IO priority class is by default idle so background
29       scrub should not significantly interfere with normal filesystem
30       operation. The IO scheduler set for the device(s) might not support the
31       priority classes 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
38       position.
39
40       Scrub can be started only on a mounted filesystem, though it’s possible
41       to scrub only a selected device. See 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 and
49           btrfs scrub cancel behaves as if it was called on that filesystem.
50           The progress is saved in the status file so btrfs scrub resume can
51           continue from the last position.
52
53       resume [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>]
54       <path>|<device>
55           Resume a cancelled or interrupted scrub on the filesystem
56           identified 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
60           successfully.
61
62           Options
63
64           see scrub start.
65
66       start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>]
67       <path>|<device>
68           Start a scrub on all devices of the mounted filesystem identified
69           by path or on a single device. If a scrub is already running, the
70           new one will not start. A device of an unmounted filesystem cannot
71           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 -n
79           options. Note that not all IO schedulers honor the ionice settings.
80
81           Options
82
83           -B
84               do not background and print scrub statistics when finished
85
86           -d
87               print separate statistics for each device of the filesystem (-B
88               only) at the end
89
90           -r
91               run in read-only mode, do not attempt to correct anything, can
92               be run on a read-only filesystem
93
94           -R
95               raw print mode, print full data instead of summary
96
97           -c <ioprio_class>
98               set IO priority class (see ionice(1) manpage)
99
100           -n <ioprio_classdata>
101               set IO priority classdata (see ionice(1) manpage)
102
103           -f
104               force starting new scrub even if a scrub is already running,
105               this can useful when scrub status file is damaged and reports a
106               running scrub although it is not, but should not normally be
107               necessary
108
109           -q
110               (deprecated) alias for global -q option
111
112       status [options] <path>|<device>
113           Show status of a running scrub for the filesystem identified by
114           path or for the specified device.
115
116           If no scrub is running, show statistics of the last finished or
117           cancelled scrub for that filesystem or device.
118
119           Options
120
121           -d
122               print separate statistics for each device of the filesystem
123
124           -R
125               print all raw statistics without postprocessing as returned by
126               the status ioctl
127
128           --raw
129               print all numbers raw values in bytes without the B suffix
130
131           --human-readable
132               print human friendly numbers, base 1024, this is the default
133
134           --iec
135               select the 1024 base for the following options, according to
136               the IEC standard
137
138           --si
139               select the 1000 base for the following options, according to
140               the SI standard
141
142           --kbytes
143               show sizes in KiB, or kB with --si
144
145           --mbytes
146               show sizes in MiB, or MB with --si
147
148           --gbytes
149               show sizes in GiB, or GB with --si
150
151           --tbytes
152               show sizes in TiB, or TB with --si
153

EXIT STATUS

155       btrfs scrub returns a zero exit status if it succeeds. Non zero is
156       returned in case of failure:
157
158       1
159           scrub couldn’t be performed
160
161       2
162           there is nothing to resume
163
164       3
165           scrub found uncorrectable errors
166

AVAILABILITY

168       btrfs is part of btrfs-progs. Please refer to the btrfs wiki
169       http://btrfs.wiki.kernel.org for further details.
170

SEE ALSO

172       mkfs.btrfs(8), ionice(1)
173
174
175
176Btrfs v5.12.1                     05/13/2021                    BTRFS-SCRUB(8)
Impressum