1BTRFS-SCRUB(8) Btrfs Manual BTRFS-SCRUB(8)
2
3
4
6 btrfs-scrub - scrub btrfs filesystem, verify block checksums
7
9 btrfs scrub <subcommand> <args>
10
12 btrfs scrub is used to scrub a btrfs filesystem, which will read all
13 data and metadata blocks from all devices and verify checksums.
14 Automatically repair corrupted blocks if there’s a correct copy
15 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
41 cancel <path>|<device>
42 If a scrub is running on the filesystem identified by path or
43 device, cancel it.
44
45 If a device is specified, the corresponding filesystem is found and
46 btrfs scrub cancel behaves as if it was called on that filesystem.
47 The progress is saved in the status file so btrfs scrub resume can
48 continue from the last position.
49
50 resume [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>]
51 <path>|<device>
52 Resume a cancelled or interrupted scrub on the filesystem
53 identified by path or on a given device. The starting point is read
54 from the status file if it exists.
55
56 This does not start a new scrub if the last scrub finished
57 successfully.
58
59 Options
60
61 see scrub start.
62
63 start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>]
64 <path>|<device>
65 Start a scrub on all devices of the filesystem identified by path
66 or on a single device. If a scrub is already running, the new one
67 will not start.
68
69 Without options, scrub is started as a background process. The
70 automatic repairs of damaged copies is performed by default for
71 block group profiles with redundancy.
72
73 The default IO priority of scrub is the idle class. The priority
74 can be configured similar to the ionice(1) syntax using -c and -n
75 options. Note that not all IO schedulers honor the ionice settings.
76
77 Options
78
79 -B
80 do not background and print scrub statistics when finished
81
82 -d
83 print separate statistics for each device of the filesystem (-B
84 only) at the end
85
86 -r
87 run in read-only mode, do not attempt to correct anything, can
88 be run on a read-only filesystem
89
90 -R
91 raw print mode, print full data instead of summary
92
93 -c <ioprio_class>
94 set IO priority class (see ionice(1) manpage)
95
96 -n <ioprio_classdata>
97 set IO priority classdata (see ionice(1) manpage)
98
99 -f
100 force starting new scrub even if a scrub is already running,
101 this can useful when scrub status file is damaged and reports a
102 running scrub although it is not, but should not normally be
103 necessary
104
105 -q
106 (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
118 print separate statistics for each device of the filesystem
119
120 -R
121 print all raw statistics without postprocessing as returned by
122 the status ioctl
123
124 --raw
125 print all numbers raw values in bytes without the B suffix
126
127 --human-readable
128 print human friendly numbers, base 1024, this is the default
129
130 --iec
131 select the 1024 base for the following options, according to
132 the IEC standard
133
134 --si
135 select the 1000 base for the following options, according to
136 the SI standard
137
138 --kbytes
139 show sizes in KiB, or kB with --si
140
141 --mbytes
142 show sizes in MiB, or MB with --si
143
144 --gbytes
145 show sizes in GiB, or GB with --si
146
147 --tbytes
148 show sizes in TiB, or TB with --si
149
151 btrfs scrub returns a zero exit status if it succeeds. Non zero is
152 returned in case of failure:
153
154 1
155 scrub couldn’t be performed
156
157 2
158 there is nothing to resume
159
160 3
161 scrub found uncorrectable errors
162
164 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
165 http://btrfs.wiki.kernel.org for further details.
166
168 mkfs.btrfs(8), ionice(1)
169
170
171
172Btrfs v5.10 01/18/2021 BTRFS-SCRUB(8)