Manpage/btrfs-check

From btrfs Wiki
(Difference between revisions)
Jump to: navigation, search
(Update from git, v4.5)
(Update from git, v4.5.3)
Line 1: Line 1:
=btrfs-check(8) Manual Page=
+
=btrfs-check(8)=
 
{{GeneratedManpage
 
{{GeneratedManpage
 
|name=btrfs-check}}
 
|name=btrfs-check}}
  
 
==NAME==
 
==NAME==
 
 
btrfs-check - check or repair an unmounted btrfs filesystem
 
btrfs-check - check or repair an unmounted btrfs filesystem
  
 
==SYNOPSIS==
 
==SYNOPSIS==
  
'''btrfs check''' [options] <device>
+
<p><b>btrfs check</b> [options] <emphasis>&lt;device&gt;</emphasis></p>
 
+
 
==DESCRIPTION==
 
==DESCRIPTION==
  
'''btrfs check''' is used to check or repair an unmounted btrfs filesystem.
+
<p>The filesystem checker is used to verify structural integrity of a filesystem
 +
and attempt to repair it if requested. The filesystem must be unmounted.</p>
 +
<p>By default, <b>btrfs check</b> will not modify the device but you can reaffirm that
 +
by the option <em>--readonly</em>.</p>
 +
<p><b>btrfsck</b> is an alias of <b>btrfs check</b> command and is now deprecated.</p>
 +
<blockquote><b>Warning:</b>
 +
Do not use <em>--repair</em> unless you are adviced to by a developer, an
 +
experienced user or accept the fact that <em>fsck</em> cannot possibly fix all sorts
 +
of damage that could happen to a filesystem because of software and hardware
 +
bugs.</blockquote>
 +
<p>The structural integrity check verifies if internal filesystem objects or
 +
data structures satisfy the constraints, point to the right objects or are
 +
correctly connected together.</p>
 +
<p>There are several cross checks that can detect wrong reference counts of shared
 +
extents, backrefrences, missing extents of inodes, directory and inode
 +
connectivity etc.</p>
 +
<p>The amount of memory required can be high, depending on the size of the
 +
filesystem, smililarly the run time.</p>
 +
==SAFE OR ADVISORY OPTIONS==
  
'''Note:''' Since btrfs is under development, the '''btrfs check''' capabilities are continuously enhanced. It’s highly recommended to read the following btrfs wiki before executing '''btrfs check''' with '''--repair''' option:<br />https://btrfs.wiki.kernel.org/index.php/Btrfsck
+
<dl>
 +
<dt>
 +
-b|--backup
 +
<dd>
 +
<p>
 +
use the first valid set of backup roots stored in the superblock
 +
</p>
 +
<p>This can be combined with <em>--super</em> if some of the superblocks are damaged.</p>
  
'''btrfsck''' is an alias of '''btrfs check''' command and is now deprecated.
+
<dt>
 +
--check-data-csum
 +
<dd>
 +
<p>
 +
verify checksums of data blocks
 +
</p>
 +
<p>This expects that the filesystem is otherwise
 +
OK, so this is basically and offline <em>scrub</em> but does not repair data from
 +
spare coipes.</p>
  
==OPTIONS==
+
<dt>
 +
--chunk-root <emphasis>&lt;bytenr&gt;</emphasis>
 +
<dd>
 +
<p>
 +
use the given offset <em>bytenr</em> for the chunk tree root
 +
</p>
  
; -s|--super &lt;superblock&gt;
+
<dt>
: use &lt;superblock&gt;th superblock copy, valid values are 0 up to 2 if the respective superblock offset is within the filesystem
+
-E|--subvol-extents <emphasis>&lt;subvolid&gt;</emphasis>
; -b|--backup
+
<dd>
: use the first backup roots stored in the superblock that is valid
+
<p>
; --repair
+
show extent state for the given subvolume
: try to repair the filesystem
+
</p>
; --readonly
+
: run in read-only mode (default)
+
; --init-csum-tree
+
: create a new CRC tree and recalculate all checksums
+
; --init-extent-tree
+
: create a new extent tree
+
; --check-data-csum
+
: verify checksums of data blocks
+
; -p|--progress
+
: indicate progress at various checking phases
+
; --qgroup-report
+
: verify qgroup accounting and compare against filesystem accounting
+
; -E|--subvol-extents &lt;subvolid&gt;
+
: show extent state for the given subvolume
+
; -r|--tree-root &lt;bytenr&gt;
+
: use the given bytenr for the tree root
+
; --chunk-root &lt;bytenr&gt;
+
: use the given bytenr for the chunk tree root
+
  
==EXIT STATUS==
+
<dt>
 +
-p|--progress
 +
<dd>
 +
<p>
 +
indicate progress at various checking phases
 +
</p>
  
'''btrfs check''' returns a zero exit status if it succeeds. Non zero is returned in case of failure.
+
<dt>
 +
--qgroup-report
 +
<dd>
 +
<p>
 +
verify qgroup accounting and compare against filesystem accounting
 +
</p>
  
==AVAILABILITY==
+
<dt>
 +
-r|--tree-root <emphasis>&lt;bytenr&gt;</emphasis>
 +
<dd>
 +
<p>
 +
use the given offset <em>bytenr</em> for the tree root
 +
</p>
  
'''btrfs''' is part of btrfs-progs. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for further details.
+
<dt>
 +
--readonly
 +
<dd>
 +
<p>
 +
(default)
 +
run in read-only mode, this option exists to calm potential panic when users
 +
are going to run the checker
 +
</p>
  
==SEE ALSO==
+
<dt>
 +
-s|--super <emphasis>&lt;superblock&gt;</emphasis>
 +
<dd>
 +
<p>
 +
use 'superblock&#8217;th superblock copy, valid values are 0, 1 or 2 if the
 +
respective superblock offset is within the device size
 +
</p>
 +
<p>This can be used to use a different starting point if some of the primary
 +
superblock is damaged.</p>
  
[[Manpage/mkfs.btrfs|mkfs.btrfs(8)]], [[Manpage/btrfs-scrub|btrfs-scrub(8)]], [[Manpage/btrfs-rescue|btrfs-rescue(8)]]
+
</dl>
 +
==DANGEROUS OPTIONS==
 +
 
 +
<dl>
 +
<dt>
 +
--repair
 +
<dd>
 +
<p>
 +
enable the repair mode and attempt to fix problems where possible
 +
</p>
 +
 
 +
<dt>
 +
--init-csum-tree
 +
<dd>
 +
<p>
 +
create a new checksum tree and recalculate checksums in all files
 +
</p>
 +
<blockquote><b>Note:</b>
 +
Do not blindly use this option to fix checksum mismatch problems.</blockquote>
 +
 
 +
<dt>
 +
--init-extent-tree
 +
<dd>
 +
<p>
 +
build the extent tree from scratch
 +
</p>
 +
<blockquote><b>Note:</b>
 +
Do not use unless you know what you&#8217;re doing.</blockquote>
 +
 
 +
<dt>
 +
--low-memory
 +
<dd>
 +
<p>
 +
check fs in low memory usage mode(experimental)
 +
May takes longer time than normal check.
 +
</p>
 +
<blockquote><b>Note:</b>
 +
Doesn&#8217;t work with <em>--repair</em> option yet.</blockquote>
 +
 
 +
</dl>
 +
==EXIT STATUS==
 +
 
 +
<p><b>btrfs check</b> returns a zero exit status if it succeeds. Non zero is
 +
returned in case of failure.</p>
 +
==AVAILABILITY==
 +
 
 +
<p><b>btrfs</b> is part of btrfs-progs.
 +
Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
 +
further details.</p>
 +
==SEE ALSO==
  
 +
<p>[[Manpage/mkfs.btrfs|mkfs.btrfs(8)]],
 +
[[Manpage/btrfs-scrub|btrfs-scrub(8)]],
 +
[[Manpage/btrfs-rescue|btrfs-rescue(8)]]</p>
 
[[Category:Manpage]]
 
[[Category:Manpage]]

Revision as of 10:05, 20 May 2016

Contents

btrfs-check(8)

Warning: this page is automatically generated from git, all edits will be lost. Current git version.


NAME

btrfs-check - check or repair an unmounted btrfs filesystem

SYNOPSIS

btrfs check [options] <emphasis><device></emphasis>

DESCRIPTION

The filesystem checker is used to verify structural integrity of a filesystem and attempt to repair it if requested. The filesystem must be unmounted.

By default, btrfs check will not modify the device but you can reaffirm that by the option --readonly.

btrfsck is an alias of btrfs check command and is now deprecated.

Warning: Do not use --repair unless you are adviced to by a developer, an experienced user or accept the fact that fsck cannot possibly fix all sorts of damage that could happen to a filesystem because of software and hardware bugs.

The structural integrity check verifies if internal filesystem objects or data structures satisfy the constraints, point to the right objects or are correctly connected together.

There are several cross checks that can detect wrong reference counts of shared extents, backrefrences, missing extents of inodes, directory and inode connectivity etc.

The amount of memory required can be high, depending on the size of the filesystem, smililarly the run time.

SAFE OR ADVISORY OPTIONS

-b|--backup

use the first valid set of backup roots stored in the superblock

This can be combined with --super if some of the superblocks are damaged.

--check-data-csum

verify checksums of data blocks

This expects that the filesystem is otherwise OK, so this is basically and offline scrub but does not repair data from spare coipes.

--chunk-root <emphasis><bytenr></emphasis>

use the given offset bytenr for the chunk tree root

-E|--subvol-extents <emphasis><subvolid></emphasis>

show extent state for the given subvolume

-p|--progress

indicate progress at various checking phases

--qgroup-report

verify qgroup accounting and compare against filesystem accounting

-r|--tree-root <emphasis><bytenr></emphasis>

use the given offset bytenr for the tree root

--readonly

(default) run in read-only mode, this option exists to calm potential panic when users are going to run the checker

-s|--super <emphasis><superblock></emphasis>

use 'superblock’th superblock copy, valid values are 0, 1 or 2 if the respective superblock offset is within the device size

This can be used to use a different starting point if some of the primary superblock is damaged.

DANGEROUS OPTIONS

--repair

enable the repair mode and attempt to fix problems where possible

--init-csum-tree

create a new checksum tree and recalculate checksums in all files

Note: Do not blindly use this option to fix checksum mismatch problems.

--init-extent-tree

build the extent tree from scratch

Note: Do not use unless you know what you’re doing.

--low-memory

check fs in low memory usage mode(experimental) May takes longer time than normal check.

Note: Doesn’t work with --repair option yet.

EXIT STATUS

btrfs check returns a zero exit status if it succeeds. Non zero is returned in case of failure.

AVAILABILITY

btrfs is part of btrfs-progs. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for further details.

SEE ALSO

mkfs.btrfs(8), btrfs-scrub(8), btrfs-rescue(8)

Personal tools