6 btrfs-scrub - scrub btrfs filesystem, verify block checksums
10 *btrfs scrub* <subcommand> <args>
14 *btrfs scrub* is used to scrub a btrfs filesystem, which will read all data
15 and metadata blocks from all devices and verify checksums. Automatically repair
16 corrupted blocks if there's a correct copy available.
18 NOTE: Scrub is not a filesystem checker (fsck) and does not verify nor repair
19 structural damage in the filesystem.
21 The user is supposed to run it manually or via a periodic system service. The
22 recommended period is a month but could be less. The estimated device bandwidth
23 utilization is about 80% on an idle filesystem. The IO priority class is by
24 default 'idle' so background scrub should not interfere with normal filesystem
25 operation significantly.
27 The scrubbing status is recorded in '/var/lib/btrfs/' in textual files named
28 'scrub.status.UUID' for a filesystem identified by the given UUID. (An
29 itermediate progress is communicated through a named pipe in file
30 'scrub.progress.UUID' in the same directory.) The status file is updated
31 periodically every 5 seconds. An resumed scrub will continue from the last
36 *cancel* <path>|<device>::
37 If a scrub is running on the filesystem identified by 'path>' cancel it.
39 If a 'device' is specified, the corresponding filesystem is found and
40 *btrfs scrub cancel* behaves as if it was called on that filesystem.
42 *resume* [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
43 Resume a cancelled or interrupted scrub on the filesystem identified by
44 'path' or on a given 'device'.
46 Does not start a new scrub if the last scrub finished successfully.
52 *start* [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
53 Start a scrub on all devices of the filesystem identified by 'path' or on
54 a single 'device'. If a scrub is already running, the new one fails.
56 Without options, scrub is started as a background process.
58 The default IO priority of scrub is the idle class. The priority can be
59 configured similar to the `ionice`(1) syntax using '-c' and '-n' options.
64 do not background and print scrub statistics when finished
66 print separate statistics for each device of the filesystem ('-B' only) at the end
68 be quiet, omit error messages and statistics
70 run in read-only mode, do not attempt to correct anything, can be run on a read-only
73 print raw statistics per-device instead of a summary
75 set IO priority class (see `ionice`(1) manpage)
76 -n <ioprio_classdata>::::
77 set IO priority classdata (see `ionice`(1) manpage)
79 force starting new scrub even if a scrub is already running,
80 this can useful when scrub status file is damaged and reports a running
81 scrub although it is not, but should not normally be necessary
83 *status* [-d] <path>|<device>::
84 Show status of a running scrub for the filesystem identified by 'path' or
85 for the specified 'device'.
87 If no scrub is running, show statistics of the last finished or cancelled scrub
88 for that filesystem or device.
93 print separate statistics for each device of the filesystem
97 *btrfs scrub* returns a zero exit status if it succeeds. Non zero is
98 returned in case of failure:
101 scrub couldn't be performed
103 there is nothing to resume
105 scrub found uncorrectable errors
109 *btrfs* is part of btrfs-progs.
110 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for