packaging: Enable LTO and set visibility to hidden
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-scrub.asciidoc
1 btrfs-scrub(8)
2 ==============
3
4 NAME
5 ----
6 btrfs-scrub - scrub btrfs filesystem, verify block checksums
7
8 SYNOPSIS
9 --------
10 *btrfs scrub* <subcommand> <args>
11
12 DESCRIPTION
13 -----------
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.
17
18 NOTE: Scrub is not a filesystem checker (fsck) and does not verify nor repair
19 structural damage in the filesystem.
20
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.
26
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.
32
33 SUBCOMMAND
34 ----------
35 *cancel* <path>|<device>::
36 If a scrub is running on the filesystem identified by 'path' cancel it.
37 +
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.
40
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'.
44 +
45 Does not start a new scrub if the last scrub finished successfully.
46 +
47 `Options`
48 +
49 see *scrub start*.
50
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.
54 +
55 Without options, scrub is started as a background process.
56 +
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.
59 +
60 `Options`
61 +
62 -B::::
63 do not background and print scrub statistics when finished
64 -d::::
65 print separate statistics for each device of the filesystem ('-B' only) at the end
66 -q::::
67 be quiet, omit error messages and statistics
68 -r::::
69 run in read-only mode, do not attempt to correct anything, can be run on a read-only
70 filesystem
71 -R::::
72 print raw statistics per-device instead of a summary
73 -c <ioprio_class>::::
74 set IO priority class (see `ionice`(1) manpage)
75 -n <ioprio_classdata>::::
76 set IO priority classdata (see `ionice`(1) manpage)
77 -f::::
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
81
82 *status* [-d] <path>|<device>::
83 Show status of a running scrub for the filesystem identified by 'path' or
84 for the specified 'device'.
85 +
86 If no scrub is running, show statistics of the last finished or cancelled scrub
87 for that filesystem or device.
88 +
89 `Options`
90 +
91 -d::::
92 print separate statistics for each device of the filesystem
93
94 EXIT STATUS
95 -----------
96 *btrfs scrub* returns a zero exit status if it succeeds. Non zero is
97 returned in case of failure:
98
99 1::::
100 scrub couldn't be performed
101 2::::
102 there is nothing to resume
103 3::::
104 scrub found uncorrectable errors
105
106 AVAILABILITY
107 ------------
108 *btrfs* is part of btrfs-progs.
109 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
110 further details.
111
112 SEE ALSO
113 --------
114 `mkfs.btrfs`(8),
115 `ionice`(1)