{"id":3462,"date":"2022-12-20T17:08:43","date_gmt":"2022-12-20T20:08:43","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/btrfsscrub-man8\/"},"modified":"2022-12-20T17:08:43","modified_gmt":"2022-12-20T20:08:43","slug":"btrfsscrub-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/btrfsscrub-man8\/","title":{"rendered":"BTRFS&minus;SCRUB (man8)"},"content":{"rendered":"<h1 align=\"center\">BTRFS\u2212SCRUB<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#SUBCOMMAND\">SUBCOMMAND<\/a><br \/> <a href=\"#EXIT STATUS\">EXIT STATUS<\/a><br \/> <a href=\"#AVAILABILITY\">AVAILABILITY<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">btrfs-scrub \u2212 scrub btrfs filesystem, verify block checksums<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>btrfs scrub<\/b> <i><subcommand> <args><\/i><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i><b>btrfs scrub<\/b><\/i> 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\u2019s a correct copy available.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b><big>Note<\/big><\/b> <br \/> Scrub is not a filesystem checker (fsck) and does not verify nor repair structural damage in the filesystem. It really only checks checksums of data and tree blocks, it doesn\u2019t ensure the content of tree blocks is valid and consistent. There\u2019s some validation performed when metadata blocks are read from disk but it\u2019s not extensive and cannot substitute full <i>btrfs check<\/i> run.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">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 utilization is about 80% on an idle filesystem. The IO priority class is by default <i>idle<\/i> so background scrub should not significantly interfere with normal filesystem operation. The IO scheduler set for the device(s) might not support the priority classes though.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The scrubbing status is recorded in <i>\/var\/lib\/btrfs\/<\/i> in textual files named <i>scrub.status.UUID<\/i> for a filesystem identified by the given UUID. (Progress state is communicated through a named pipe in file <i>scrub.progress.UUID<\/i> in the same directory.) The status file is updated every 5 seconds. A resumed scrub will continue from the last saved position.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Scrub can be started only on a mounted filesystem, though it\u2019s possible to scrub only a selected device. See <b>scrub start<\/b> for more.<\/p>\n<h2>SUBCOMMAND <a name=\"SUBCOMMAND\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><big>cancel<\/big><\/b> <big><i><path><\/i>|<i><device><\/i><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>If a scrub is running on the filesystem identified by <i>path<\/i> or <i>device<\/i>, cancel it.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>If a <i>device<\/i> is specified, the corresponding filesystem is found and <b>btrfs scrub cancel<\/b> behaves as if it was called on that filesystem. The progress is saved in the status file so <b>btrfs scrub resume<\/b> can continue from the last position.<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>resume<\/b> [\u2212BdqrR] [\u2212c <i><ioprio_class><\/i> \u2212n <i><ioprio_classdata><\/i>] <i><path><\/i>|<i><device><\/i><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>Resume a cancelled or interrupted scrub on the filesystem identified by <i>path<\/i> or on a given <i>device<\/i>. The starting point is read from the status file if it exists.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>This does not start a new scrub if the last scrub finished successfully.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><b>Options<\/b><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>see <b>scrub start<\/b>.<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>start<\/b> [\u2212BdqrRf] [\u2212c <i><ioprio_class><\/i> \u2212n <i><ioprio_classdata><\/i>] <i><path><\/i>|<i><device><\/i><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>Start a scrub on all devices of the mounted filesystem identified by <i>path<\/i> or on a single <i>device<\/i>. If a scrub is already running, the new one will not start. A device of an unmounted filesystem cannot be scrubbed this way.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>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.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>The default IO priority of scrub is the idle class. The priority can be configured similar to the <b>ionice<\/b>(1) syntax using <i>\u2212c<\/i> and <i>\u2212n<\/i> options. Note that not all IO schedulers honor the ionice settings.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><b>Options<\/b><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212B<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>do not background and print scrub statistics when finished<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212d<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>print separate statistics for each device of the filesystem (<i>\u2212B<\/i> only) at the end<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212r<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>run in read\u2212only mode, do not attempt to correct anything, can be run on a read\u2212only filesystem<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212R<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>raw print mode, print full data instead of summary<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212c <i><ioprio_class><\/i><\/big><\/p>\n<p style=\"margin-left:23%;\"><big>set IO priority class (see <b>ionice<\/b>(1) manpage)<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212n <i><ioprio_classdata><\/i><\/big><\/p>\n<p style=\"margin-left:23%;\"><big>set IO priority classdata (see <b>ionice<\/b>(1) manpage)<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212f<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>force starting new scrub even if a scrub is already running, this can useful when scrub status file is damaged and reports a running scrub although it is not, but should not normally be necessary<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212q<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>(deprecated) alias for global <i>\u2212q<\/i> option<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>status<\/b> [options] <i><path><\/i>|<i><device><\/i><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>Show status of a running scrub for the filesystem identified by <i>path<\/i> or for the specified <i>device<\/i>.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>If no scrub is running, show statistics of the last finished or cancelled scrub for that filesystem or device.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><b>Options<\/b><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212d<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>print separate statistics for each device of the filesystem<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212R<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>print all raw statistics without postprocessing as returned by the status ioctl<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212raw<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>print all numbers raw values in bytes without the <i>B<\/i> suffix<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212human\u2212readable<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>print human friendly numbers, base 1024, this is the default<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212iec<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>select the 1024 base for the following options, according to the IEC standard<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212si<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>select the 1000 base for the following options, according to the SI standard<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212kbytes<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>show sizes in KiB, or kB with \u2212\u2212si<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212mbytes<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>show sizes in MiB, or MB with \u2212\u2212si<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212gbytes<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>show sizes in GiB, or GB with \u2212\u2212si<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>\u2212\u2212tbytes<\/big><\/p>\n<p style=\"margin-left:23%;\"><big>show sizes in TiB, or TB with \u2212\u2212si<\/big><\/p>\n<h2>EXIT STATUS <a name=\"EXIT STATUS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>btrfs scrub<\/b> returns a zero exit status if it succeeds. Non zero is returned in case of failure:<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>1<\/big><\/p>\n<p style=\"margin-left:17%;\"><big>scrub couldn\u2019t be performed<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>2<\/big><\/p>\n<p style=\"margin-left:17%;\"><big>there is nothing to resume<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>3<\/big><\/p>\n<p style=\"margin-left:17%;\"><big>scrub found uncorrectable errors<\/big><\/p>\n<h2>AVAILABILITY <a name=\"AVAILABILITY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>btrfs<\/b> is part of btrfs\u2212progs. Please refer to the btrfs wiki <b><font color=\"#0000FF\">http:\/\/btrfs.wiki.kernel.org<\/font><\/b> <font color=\"#000000\">for further details.<\/font><\/big><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><b>mkfs.btrfs<\/b>(8), <b>ionice<\/b>(1)<\/font><\/big><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  btrfs-scrub \u2212 scrub btrfs filesystem, verify block checksums <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,588,4],"class_list":["post-3462","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-btrfs-scrub","tag-man8"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3462"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3462\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}