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 -q
87 be quiet, omit error messages and statistics
88
89 -r
90 run in read-only mode, do not attempt to correct anything, can
91 be run on a read-only filesystem
92
93 -R
94 raw print mode, print full data instead of summary
95
96 -c <ioprio_class>
97 set IO priority class (see ionice(1) manpage)
98
99 -n <ioprio_classdata>
100 set IO priority classdata (see ionice(1) manpage)
101
102 -f
103 force starting new scrub even if a scrub is already running,
104 this can useful when scrub status file is damaged and reports a
105 running scrub although it is not, but should not normally be
106 necessary
107
108 status [-d] <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
121 btrfs scrub returns a zero exit status if it succeeds. Non zero is
122 returned in case of failure:
123
124 1
125 scrub couldn’t be performed
126
127 2
128 there is nothing to resume
129
130 3
131 scrub found uncorrectable errors
132
134 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
135 http://btrfs.wiki.kernel.org for further details.
136
138 mkfs.btrfs(8), ionice(1)
139
140
141
142Btrfs v5.6 04/05/2020 BTRFS-SCRUB(8)