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 of data and tree blocks, it doesn’t ensure the content
21 of 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.
31
32 The scrubbing status is recorded in /var/lib/btrfs/ in textual files
33 named scrub.status.UUID for a filesystem identified by the given UUID.
34 (Progress state is communicated through a named pipe in file
35 scrub.progress.UUID in the same directory.) The status file is updated
36 every 5 seconds. A resumed scrub will continue from the last saved
37 position.
38
40 cancel <path>|<device>
41 If a scrub is running on the filesystem identified by path cancel
42 it.
43
44 If a device is specified, the corresponding filesystem is found and
45 btrfs scrub cancel behaves as if it was called on that filesystem.
46
47 resume [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>]
48 <path>|<device>
49 Resume a cancelled or interrupted scrub on the filesystem
50 identified by path or on a given device.
51
52 Does not start a new scrub if the last scrub finished successfully.
53
54 Options
55
56 see scrub start.
57
58 start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>]
59 <path>|<device>
60 Start a scrub on all devices of the filesystem identified by path
61 or on a single device. If a scrub is already running, the new one
62 fails.
63
64 Without options, scrub is started as a background process.
65
66 The default IO priority of scrub is the idle class. The priority
67 can be configured similar to the ionice(1) syntax using -c and -n
68 options.
69
70 Options
71
72 -B
73 do not background and print scrub statistics when finished
74
75 -d
76 print separate statistics for each device of the filesystem (-B
77 only) at the end
78
79 -q
80 be quiet, omit error messages and statistics
81
82 -r
83 run in read-only mode, do not attempt to correct anything, can
84 be run on a read-only filesystem
85
86 -R
87 raw print mode, print full data instead of summary
88
89 -c <ioprio_class>
90 set IO priority class (see ionice(1) manpage)
91
92 -n <ioprio_classdata>
93 set IO priority classdata (see ionice(1) manpage)
94
95 -f
96 force starting new scrub even if a scrub is already running,
97 this can useful when scrub status file is damaged and reports a
98 running scrub although it is not, but should not normally be
99 necessary
100
101 status [-d] <path>|<device>
102 Show status of a running scrub for the filesystem identified by
103 path or for the specified device.
104
105 If no scrub is running, show statistics of the last finished or
106 cancelled scrub for that filesystem or device.
107
108 Options
109
110 -d
111 print separate statistics for each device of the filesystem
112
114 btrfs scrub returns a zero exit status if it succeeds. Non zero is
115 returned in case of failure:
116
117 1
118 scrub couldn’t be performed
119
120 2
121 there is nothing to resume
122
123 3
124 scrub found uncorrectable errors
125
127 btrfs is part of btrfs-progs. Please refer to the btrfs wiki
128 http://btrfs.wiki.kernel.org for further details.
129
131 mkfs.btrfs(8), ionice(1)
132
133
134
135Btrfs v5.1 05/17/2019 BTRFS-SCRUB(8)