2014-04-02 08:29:17 +00:00
|
|
|
btrfs-scrub(8)
|
|
|
|
==============
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2016-05-06 10:42:21 +00:00
|
|
|
btrfs-scrub - scrub btrfs filesystem, verify block checksums
|
2014-04-02 08:29:17 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2014-05-19 15:49:35 +00:00
|
|
|
*btrfs scrub* <subcommand> <args>
|
2014-04-02 08:29:17 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2021-01-29 14:12:34 +00:00
|
|
|
*btrfs scrub* is used to scrub a mounted btrfs filesystem, which will read all
|
|
|
|
data and metadata blocks from all devices and verify checksums. Automatically
|
|
|
|
repair corrupted blocks if there's a correct copy available.
|
2014-04-02 08:29:17 +00:00
|
|
|
|
2016-07-14 21:35:26 +00:00
|
|
|
NOTE: Scrub is not a filesystem checker (fsck) and does not verify nor repair
|
2019-07-02 13:17:47 +00:00
|
|
|
structural damage in the filesystem. It really only checks checksums of data
|
2018-11-27 14:14:37 +00:00
|
|
|
and tree blocks, it doesn't ensure the content of tree blocks is valid and
|
|
|
|
consistent. There's some validation performed when metadata blocks are read
|
|
|
|
from disk but it's not extensive and cannot substitute full 'btrfs check' run.
|
2016-07-14 21:35:26 +00:00
|
|
|
|
|
|
|
The user is supposed to run it manually or via a periodic system service. The
|
|
|
|
recommended period is a month but could be less. The estimated device bandwidth
|
2016-09-25 01:26:41 +00:00
|
|
|
utilization is about 80% on an idle filesystem. The IO priority class is by
|
2017-12-07 20:26:09 +00:00
|
|
|
default 'idle' so background scrub should not significantly interfere with
|
2020-01-15 16:14:17 +00:00
|
|
|
normal filesystem operation. The IO scheduler set for the device(s) might not
|
|
|
|
support the priority classes though.
|
2016-07-14 21:35:26 +00:00
|
|
|
|
|
|
|
The scrubbing status is recorded in '/var/lib/btrfs/' in textual files named
|
2017-02-21 23:14:38 +00:00
|
|
|
'scrub.status.UUID' for a filesystem identified by the given UUID. (Progress
|
|
|
|
state is communicated through a named pipe in file 'scrub.progress.UUID' in the
|
|
|
|
same directory.) The status file is updated every 5 seconds. A resumed scrub
|
|
|
|
will continue from the last saved position.
|
2016-07-14 21:35:26 +00:00
|
|
|
|
2021-01-29 14:12:34 +00:00
|
|
|
Scrub can be started only on a mounted filesystem, though it's possible to
|
|
|
|
scrub only a selected device. See *scrub start* for more.
|
|
|
|
|
2014-04-02 08:29:17 +00:00
|
|
|
SUBCOMMAND
|
|
|
|
----------
|
2015-01-03 01:22:10 +00:00
|
|
|
*cancel* <path>|<device>::
|
2020-01-15 16:14:17 +00:00
|
|
|
If a scrub is running on the filesystem identified by 'path' or 'device',
|
|
|
|
cancel it.
|
2015-01-03 01:22:10 +00:00
|
|
|
+
|
2016-05-06 10:42:21 +00:00
|
|
|
If a 'device' is specified, the corresponding filesystem is found and
|
|
|
|
*btrfs scrub cancel* behaves as if it was called on that filesystem.
|
2020-01-15 16:14:17 +00:00
|
|
|
The progress is saved in the status file so *btrfs scrub resume* can continue
|
|
|
|
from the last position.
|
2015-01-03 01:22:10 +00:00
|
|
|
|
|
|
|
*resume* [-BdqrR] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
|
2016-05-06 10:42:21 +00:00
|
|
|
Resume a cancelled or interrupted scrub on the filesystem identified by
|
2020-01-15 16:14:17 +00:00
|
|
|
'path' or on a given 'device'. The starting point is read from the status file
|
|
|
|
if it exists.
|
2015-01-03 01:22:10 +00:00
|
|
|
+
|
2020-01-15 16:14:17 +00:00
|
|
|
This does not start a new scrub if the last scrub finished successfully.
|
2015-01-03 01:22:10 +00:00
|
|
|
+
|
|
|
|
`Options`
|
|
|
|
+
|
|
|
|
see *scrub start*.
|
|
|
|
|
2014-05-19 15:49:35 +00:00
|
|
|
*start* [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device>::
|
2021-01-29 14:12:34 +00:00
|
|
|
Start a scrub on all devices of the mounted filesystem identified by 'path' or
|
|
|
|
on a single 'device'. If a scrub is already running, the new one will not
|
|
|
|
start. A device of an unmounted filesystem cannot be scrubbed this way.
|
2014-04-02 08:29:17 +00:00
|
|
|
+
|
2020-01-15 16:14:17 +00:00
|
|
|
Without options, scrub is started as a background process. The automatic
|
|
|
|
repairs of damaged copies is performed by default for block group profiles with
|
|
|
|
redundancy.
|
2014-04-02 08:29:17 +00:00
|
|
|
+
|
|
|
|
The default IO priority of scrub is the idle class. The priority can be
|
|
|
|
configured similar to the `ionice`(1) syntax using '-c' and '-n' options.
|
2020-01-15 16:14:17 +00:00
|
|
|
Note that not all IO schedulers honor the ionice settings.
|
2014-04-02 08:29:17 +00:00
|
|
|
+
|
|
|
|
`Options`
|
|
|
|
+
|
|
|
|
-B::::
|
2016-05-06 10:42:21 +00:00
|
|
|
do not background and print scrub statistics when finished
|
2014-04-02 08:29:17 +00:00
|
|
|
-d::::
|
2016-07-14 21:35:26 +00:00
|
|
|
print separate statistics for each device of the filesystem ('-B' only) at the end
|
2014-04-02 08:29:17 +00:00
|
|
|
-r::::
|
2016-07-14 21:35:26 +00:00
|
|
|
run in read-only mode, do not attempt to correct anything, can be run on a read-only
|
2016-05-06 10:42:21 +00:00
|
|
|
filesystem
|
2014-04-02 08:29:17 +00:00
|
|
|
-R::::
|
2018-09-03 03:07:07 +00:00
|
|
|
raw print mode, print full data instead of summary
|
2014-05-19 15:08:56 +00:00
|
|
|
-c <ioprio_class>::::
|
2016-05-06 10:42:21 +00:00
|
|
|
set IO priority class (see `ionice`(1) manpage)
|
2014-05-19 15:08:56 +00:00
|
|
|
-n <ioprio_classdata>::::
|
2016-05-06 10:42:21 +00:00
|
|
|
set IO priority classdata (see `ionice`(1) manpage)
|
2014-04-02 08:29:17 +00:00
|
|
|
-f::::
|
2016-05-06 10:42:21 +00:00
|
|
|
force starting new scrub even if a scrub is already running,
|
2016-07-14 21:35:26 +00:00
|
|
|
this can useful when scrub status file is damaged and reports a running
|
|
|
|
scrub although it is not, but should not normally be necessary
|
2020-06-26 20:20:56 +00:00
|
|
|
-q::::
|
|
|
|
(deprecated) alias for global '-q' option
|
2014-04-02 08:29:17 +00:00
|
|
|
|
2020-11-04 21:40:52 +00:00
|
|
|
*status* [options] <path>|<device>::
|
2016-05-06 10:42:21 +00:00
|
|
|
Show status of a running scrub for the filesystem identified by 'path' or
|
|
|
|
for the specified 'device'.
|
2014-04-02 08:29:17 +00:00
|
|
|
+
|
2016-03-14 13:10:16 +00:00
|
|
|
If no scrub is running, show statistics of the last finished or cancelled scrub
|
2014-04-02 08:29:17 +00:00
|
|
|
for that filesystem or device.
|
|
|
|
+
|
|
|
|
`Options`
|
|
|
|
+
|
|
|
|
-d::::
|
2016-05-06 10:42:21 +00:00
|
|
|
print separate statistics for each device of the filesystem
|
2020-11-04 21:40:52 +00:00
|
|
|
-R::::
|
|
|
|
print all raw statistics without postprocessing as returned by the status ioctl
|
2020-11-04 21:25:15 +00:00
|
|
|
--raw::::
|
|
|
|
print all numbers raw values in bytes without the 'B' suffix
|
|
|
|
--human-readable::::
|
|
|
|
print human friendly numbers, base 1024, this is the default
|
|
|
|
--iec::::
|
|
|
|
select the 1024 base for the following options, according to the IEC standard
|
|
|
|
--si::::
|
|
|
|
select the 1000 base for the following options, according to the SI standard
|
2020-12-11 16:08:31 +00:00
|
|
|
--kbytes::::
|
2020-11-04 21:25:15 +00:00
|
|
|
show sizes in KiB, or kB with --si
|
2020-12-11 16:08:31 +00:00
|
|
|
--mbytes::::
|
2020-11-04 21:25:15 +00:00
|
|
|
show sizes in MiB, or MB with --si
|
2020-12-11 16:08:31 +00:00
|
|
|
--gbytes::::
|
2020-11-04 21:25:15 +00:00
|
|
|
show sizes in GiB, or GB with --si
|
2020-12-11 16:08:31 +00:00
|
|
|
--tbytes::::
|
2020-11-04 21:25:15 +00:00
|
|
|
show sizes in TiB, or TB with --si
|
2014-04-02 08:29:17 +00:00
|
|
|
|
|
|
|
EXIT STATUS
|
|
|
|
-----------
|
2014-09-19 01:49:59 +00:00
|
|
|
*btrfs scrub* returns a zero exit status if it succeeds. Non zero is
|
2016-09-23 21:51:57 +00:00
|
|
|
returned in case of failure:
|
|
|
|
|
|
|
|
1::::
|
|
|
|
scrub couldn't be performed
|
|
|
|
2::::
|
|
|
|
there is nothing to resume
|
|
|
|
3::::
|
|
|
|
scrub found uncorrectable errors
|
2014-04-02 08:29:17 +00:00
|
|
|
|
|
|
|
AVAILABILITY
|
|
|
|
------------
|
2014-05-19 16:04:26 +00:00
|
|
|
*btrfs* is part of btrfs-progs.
|
2014-04-02 08:29:17 +00:00
|
|
|
Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
|
|
|
|
further details.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
`mkfs.btrfs`(8),
|
2016-07-14 21:35:26 +00:00
|
|
|
`ionice`(1)
|