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 significantly interfere with
25 normal filesystem operation.
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. (Progress
29 state is communicated through a named pipe in file 'scrub.progress.UUID' in the
30 same directory.) The status file is updated every 5 seconds. A resumed scrub
31 will continue from the last saved position.
35 *cancel* <path>|<device>::
36 If a scrub is running on the filesystem identified by 'path' cancel it.
38 If a 'device' is specified, the corresponding filesystem is found and
39 *btrfs scrub cancel* behaves as if it was called on that filesystem.
41 *resume* [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
42 Resume a cancelled or interrupted scrub on the filesystem identified by
43 'path' or on a given 'device'.
45 Does not start a new scrub if the last scrub finished successfully.
51 *start* [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
52 Start a scrub on all devices of the filesystem identified by 'path' or on
53 a single 'device'. If a scrub is already running, the new one fails.
55 Without options, scrub is started as a background process.
57 The default IO priority of scrub is the idle class. The priority can be
58 configured similar to the `ionice`(1) syntax using '-c' and '-n' options.
63 do not background and print scrub statistics when finished
65 print separate statistics for each device of the filesystem ('-B' only) at the end
67 be quiet, omit error messages and statistics
69 run in read-only mode, do not attempt to correct anything, can be run on a read-only
72 print raw statistics per-device instead of a summary
74 set IO priority class (see `ionice`(1) manpage)
75 -n <ioprio_classdata>::::
76 set IO priority classdata (see `ionice`(1) manpage)
78 force starting new scrub even if a scrub is already running,
79 this can useful when scrub status file is damaged and reports a running
80 scrub although it is not, but should not normally be necessary
82 *status* [-d] <path>|<device>::
83 Show status of a running scrub for the filesystem identified by 'path' or
84 for the specified 'device'.
86 If no scrub is running, show statistics of the last finished or cancelled scrub
87 for that filesystem or device.
92 print separate statistics for each device of the filesystem
96 *btrfs scrub* returns a zero exit status if it succeeds. Non zero is
97 returned in case of failure:
100 scrub couldn't be performed
102 there is nothing to resume
104 scrub found uncorrectable errors
108 *btrfs* is part of btrfs-progs.
109 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for