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

NAME

6       btrfs-check - check or repair a 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. It is recommended to
14       unmount the filesystem prior to running the check, but it is possible
15       to start checking a mounted filesystem (see --force).
16
17       By default, btrfs check will not modify the device but you can reaffirm
18       that by the option --readonly.
19
20       btrfsck is an alias of btrfs check command and is now deprecated.
21
22           Warning
23           Do not use --repair unless you are advised to do so by a developer
24           or an experienced user, and then only after having accepted that no
25           fsck successfully repair all types of filesystem corruption. Eg.
26           some other software or hardware bugs can fatally damage a volume.
27
28       The structural integrity check verifies if internal filesystem objects
29       or data structures satisfy the constraints, point to the right objects
30       or are correctly connected together.
31
32       There are several cross checks that can detect wrong reference counts
33       of shared extents, backreferences, missing extents of inodes, directory
34       and inode connectivity etc.
35
36       The amount of memory required can be high, depending on the size of the
37       filesystem, similarly the run time. Check the modes that can also
38       affect that.
39

SAFE OR ADVISORY OPTIONS

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

DANGEROUS OPTIONS

94       --repair
95           enable the repair mode and attempt to fix problems where possible
96
97               Note
98               there’s a warning and 10 second delay when this option is run
99               without --force to give users a chance to think twice before
100               running repair, the warnings in documentation have shown to be
101               insufficient
102
103       --init-csum-tree
104           create a new checksum tree and recalculate checksums in all files
105
106               Note
107               Do not blindly use this option to fix checksum mismatch
108               problems.
109
110       --init-extent-tree
111           build the extent tree from scratch
112
113               Note
114               Do not use unless you know what you’re doing.
115
116       --mode <MODE>
117           select mode of operation regarding memory and IO
118
119           The MODE can be one of:
120
121           original
122               The metadata are read into memory and verified, thus the
123               requirements are high on large filesystems and can even lead to
124               out-of-memory conditions. The possible workaround is to export
125               the block device over network to a machine with enough memory.
126
127           lowmem
128               This mode is supposed to address the high memory consumption at
129               the cost of increased IO when it needs to re-read blocks. This
130               may increase run time.
131
132                   Note
133                   lowmem mode does not work with --repair yet, and is still
134                   considered experimental.
135
136       --force
137           allow work on a mounted filesystem. Note that this should work fine
138           on a quiescent or read-only mounted filesystem but may crash if the
139           device is changed externally, eg. by the kernel module. Repair
140           without mount checks is not supported right now.
141
142           This option also skips the delay and warning in the repair mode
143           (see --repair).
144

EXIT STATUS

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

AVAILABILITY

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

SEE ALSO

154       mkfs.btrfs(8), btrfs-scrub(8), btrfs-rescue(8)
155
156
157
158Btrfs v5.6                        04/05/2020                    BTRFS-CHECK(8)
Impressum