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