1BTRFS-RESCUE(8)                      BTRFS                     BTRFS-RESCUE(8)
2
3
4

NAME

6       btrfs-rescue - recover a damaged btrfs filesystem
7

SYNOPSIS

9       btrfs rescue <subcommand> <args>
10

DESCRIPTION

12       btrfs rescue is used to try to recover a damaged btrfs filesystem.
13

SUBCOMMAND

15       chunk-recover [options] <device>
16              Recover the chunk tree by scanning the devices
17
18              Options
19
20              -y     assume an answer of yes to all questions.
21
22              -h     help.
23
24              -v     (deprecated) alias for global -v option
25
26       NOTE:
27          Since chunk-recover will scan the whole device, it will be very slow
28          especially executed on a large device.
29
30       fix-device-size <device>
31              fix device size and super block total bytes values that  are  do
32              not match
33
34              Kernel  4.11  starts  to check the device size more strictly and
35              this might mismatch the stored value of total bytes. See the ex‐
36              act  error message below.  Newer kernel will refuse to mount the
37              filesystem where the values do not match.  This error is not fa‐
38              tal  and  can  be  fixed.  This command will fix the device size
39              values if possible.
40
41                 BTRFS error (device sdb): super_total_bytes 92017859088384 mismatch with fs_devices total_rw_bytes 92017859094528
42
43              The mismatch may also exhibit as a kernel warning:
44
45                 WARNING: CPU: 3 PID: 439 at fs/btrfs/ctree.h:1559 btrfs_update_device+0x1c5/0x1d0 [btrfs]
46
47       clear-uuid-tree <device>
48              Clear UUID tree, so that  kernel  can  re-generate  it  at  next
49              read-write mount.
50
51              Since  kernel  v4.16  there are more sanity check performed, and
52              sometimes non-critical trees like UUID tree can  cause  problems
53              and reject the mount.  In such case, clearing UUID tree may make
54              the filesystem to be mountable again without much risk  as  it's
55              built from other trees.
56
57       super-recover [options] <device>
58              Recover bad superblocks from good copies.
59
60              Options
61
62              -y     assume an answer of yes to all questions.
63
64              -v     (deprecated) alias for global -v option
65
66       zero-log <device>
67              clear the filesystem log tree
68
69              This  command will clear the filesystem log tree. This may fix a
70              specific set of problem when the filesystem mount fails  due  to
71              the  log replay. See below for sample stack traces that may show
72              up in system log.
73
74              The common case where this happens was fixed a long time ago, so
75              it  is  unlikely  that you will see this particular problem, but
76              the command is kept around.
77
78              NOTE:
79                 Clearing the log may lead to loss of changes that  were  made
80                 since  the last transaction commit. This may be up to 30 sec‐
81                 onds (default commit period) or less if the  commit  was  im‐
82                 plied by other filesystem activity.
83
84              One  can  determine  whether zero-log is needed according to the
85              kernel backtrace:
86
87                 ? replay_one_dir_item+0xb5/0xb5 [btrfs]
88                 ? walk_log_tree+0x9c/0x19d [btrfs]
89                 ? btrfs_read_fs_root_no_radix+0x169/0x1a1 [btrfs]
90                 ? btrfs_recover_log_trees+0x195/0x29c [btrfs]
91                 ? replay_one_dir_item+0xb5/0xb5 [btrfs]
92                 ? btree_read_extent_buffer_pages+0x76/0xbc [btrfs]
93                 ? open_ctree+0xff6/0x132c [btrfs]
94
95              If the errors are like above, then zero-log should  be  used  to
96              clear  the log and the filesystem may be mounted normally again.
97              The keywords to look for are 'open_ctree' which says  that  it's
98              during  mount and function names that contain replay, recover or
99              log_tree.
100

EXIT STATUS

102       btrfs rescue returns a zero exit status if it succeeds. Non zero is re‐
103       turned in case of failure.
104

AVAILABILITY

106       btrfs  is  part  of  btrfs-progs.  Please refer to the documentation at
107       https://btrfs.readthedocs.io or wiki  http://btrfs.wiki.kernel.org  for
108       further information.
109

SEE ALSO

111       btrfs-check(8), btrfs-scrub(8), mkfs.btrfs(8)
112
113
114
115
1166.1.3                            Jan 25, 2023                  BTRFS-RESCUE(8)
Impressum