1BTRFS-CHECK(8)                   Btrfs Manual                   BTRFS-CHECK(8)
2
3
4

NAME

6       btrfs-check - check or repair an unmounted btrfs filesystem
7

SYNOPSIS

9       btrfs check [options] <device>
10

DESCRIPTION

12       The filesystem checker is used to verify structural integrity of a
13       filesystem and attempt to repair it if requested. The filesystem must
14       be unmounted.
15
16       By default, btrfs check will not modify the device but you can reaffirm
17       that by the option --readonly.
18
19       btrfsck is an alias of btrfs check command and is now deprecated.
20
21           Warning
22           Do not use --repair unless you are advised to by a developer, an
23           experienced user or accept the fact that fsck cannot possibly fix
24           all sorts of damage that could happen to a filesystem because of
25           software and hardware bugs.
26
27       The structural integrity check verifies if internal filesystem objects
28       or data structures satisfy the constraints, point to the right objects
29       or are correctly connected together.
30
31       There are several cross checks that can detect wrong reference counts
32       of shared extents, backrefrences, missing extents of inodes, directory
33       and inode connectivity etc.
34
35       The amount of memory required can be high, depending on the size of the
36       filesystem, smililarly the run time.
37

SAFE OR ADVISORY OPTIONS

39       -b|--backup
40           use the first valid set of backup roots stored in the superblock
41
42           This can be combined with --super if some of the superblocks are
43           damaged.
44
45       --check-data-csum
46           verify checksums of data blocks
47
48           This expects that the filesystem is otherwise OK, so this is
49           basically and offline scrub but does not repair data from spare
50           coipes.
51
52       --chunk-root <bytenr>
53           use the given offset bytenr for the chunk tree root
54
55       -E|--subvol-extents <subvolid>
56           show extent state for the given subvolume
57
58       -p|--progress
59           indicate progress at various checking phases
60
61       --qgroup-report
62           verify qgroup accounting and compare against filesystem accounting
63
64       -r|--tree-root <bytenr>
65           use the given offset bytenr for the tree root
66
67       --readonly
68           (default) run in read-only mode, this option exists to calm
69           potential panic when users are going to run the checker
70
71       -s|--super <superblock>
72           use 'superblock’th superblock copy, valid values are 0, 1 or 2 if
73           the respective superblock offset is within the device size
74
75           This can be used to use a different starting point if some of the
76           primary superblock is damaged.
77
78       --clear-space-cache v1|v2
79           completely wipe all free space cache of given type
80
81           For free space cache v1, the clear_cache kernel mount option only
82           rebuilds the free space cache for block groups that are modified
83           while the filesystem is mounted with that option. Thus, using this
84           option with v1 makes it possible to actually clear the entire free
85           space cache.
86
87           For free space cache v2, the clear_cache kernel mount option does
88           destroy the entire free space cache. This option with v2 provides
89           an alternative method of clearing the free space cache that doesn’t
90           require mounting the filesystem.
91

DANGEROUS OPTIONS

93       --repair
94           enable the repair mode and attempt to fix problems where possible
95
96       --init-csum-tree
97           create a new checksum tree and recalculate checksums in all files
98
99               Note
100               Do not blindly use this option to fix checksum mismatch
101               problems.
102
103       --init-extent-tree
104           build the extent tree from scratch
105
106               Note
107               Do not use unless you know what you’re doing.
108
109       --mode=MODE
110           select mode of operation regarding memory and IO
111
112           The MODE can be one of original and lowmem. The original mode is
113           mostly unoptimized regarding memory consumpption and can lead to
114           out-of-memory conditions on large filesystems. The possible
115           workaround is to export the block device over network to a machine
116           with enough memory. The low memory mode is supposed to address the
117           memory consumption, at the cost of increased IO when it needs to
118           re-read blocks when needed. This may increase run time.
119
120           Note
121           lowmem mode does not work with --repair yet, and is still
122           considered experimental.
123

EXIT STATUS

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

AVAILABILITY

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

SEE ALSO

133       mkfs.btrfs(8), btrfs-scrub(8), btrfs-rescue(8)
134
135
136
137Btrfs v4.9.1                      08/06/2017                    BTRFS-CHECK(8)
Impressum