我最近停电了,重新启动后我无法挂载设置为 raid 5 的 btrfs 分区。
root@ubuntu:~# mdadm -D /dev/md2
/dev/md2:
Version : 1.2
Creation Time : Thu Jun 6 20:37:19 2019
Raid Level : raid5
Array Size : 8776333632 (8369.76 GiB 8986.97 GB)
Used Dev Size : 2925444544 (2789.92 GiB 2995.66 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Fri Sep 6 11:48:27 2019
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
Consistency Policy : resync
Name : design:2
UUID : 6bdfacf4:608de1bd:c9e76f1f:b66e55f7
Events : 1179
Number Major Minor RaidDevice State
4 8 83 0 active sync /dev/sdf3
5 8 35 1 active sync /dev/sdc3
2 8 19 2 active sync /dev/sdb3
3 8 3 3 active sync /dev/sda3
以下是当前的 btrfs 文件系统
root@ubuntu:~# btrfs filesystem show
Label: '2019.06.08-23:28:42 v24922' uuid: e3675fea-e2bb-4261-b53e-4833844e9527
Total devices 1 FS bytes used 7.41TiB
devid 1 size 8.17TiB used 7.65TiB path /dev/md2
当我尝试安装它时,出现以下错误。
root@ubuntu:~# mount -vs -t btrfs -o ro,recovery,errors=continue /dev/md2 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/md2, missing codepage or helper program, or other error.
我看到了下面关于通过树根修复的问题的答案,我按照命令操作,但现在不知道该选择哪个块作为树根
因此,我运行了第一个命令来列出超级块,我认为它们看起来不错。
root@ubuntu:~# btrfs rescue super-recover -v /dev/md2
All Devices:
Device: id = 1, name = /dev/md2
Before Recovering:
[All good supers]:
device name = /dev/md2
superblock bytenr = 65536
device name = /dev/md2
superblock bytenr = 67108864
device name = /dev/md2
superblock bytenr = 274877906944
[All bad supers]:
All supers are valid, no need to recover
然后,当我尝试查找根时,我得到以下结果:
root@ubuntu:~# btrfs-find-root /dev/md2
parent transid verify failed on 2234898661376 wanted 199897 found 199895
parent transid verify failed on 2234898661376 wanted 199897 found 199895
parent transid verify failed on 2234898661376 wanted 199897 found 199895
Ignoring transid failure
Couldn't setup extent tree
Couldn't setup device tree
leaf free space ret -2088429181, leaf data size 16283, used 2088445464 nritems 353
leaf free space ret -2088429181, leaf data size 16283, used 2088445464 nritems 353
leaf free space incorrect 2234899513344 -2088429181
incorrect offsets 16007 16135
bad key ordering 0 1
bad key ordering 0 1
ctree.c:1720: leaf_space_used: Warning: assertion `data_len < 0` failed, value 1
btrfs-find-root(+0xb92b)[0x55974f83e92b]
btrfs-find-root(btrfs_leaf_free_space+0xd3)[0x55974f84093c]
btrfs-find-root(btrfs_check_leaf+0xef)[0x55974f840a41]
btrfs-find-root(read_tree_block+0x237)[0x55974f847dea]
btrfs-find-root(btrfs_find_root_search+0x23f)[0x55974f86bce7]
btrfs-find-root(main+0x297)[0x55974f875a94]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fc9597b3b97]
btrfs-find-root(_start+0x2a)[0x55974f83e1ea]
incorrect offsets 2303983459 16233
leaf free space ret -2129775222, leaf data size 16283, used 2129791505 nritems 6
leaf free space ret -2129775222, leaf data size 16283, used 2129791505 nritems 6
leaf free space incorrect 2234900283392 -2129775222
ctree.c:1720: leaf_space_used: Warning: assertion `data_len < 0` failed, value 1
btrfs-find-root(+0xb92b)[0x55974f83e92b]
btrfs-find-root(btrfs_leaf_free_space+0xd3)[0x55974f84093c]
btrfs-find-root(btrfs_check_leaf+0xef)[0x55974f840a41]
btrfs-find-root(read_tree_block+0x237)[0x55974f847dea]
btrfs-find-root(btrfs_find_root_search+0x23f)[0x55974f86bce7]
btrfs-find-root(main+0x297)[0x55974f875a94]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fc9597b3b97]
btrfs-find-root(_start+0x2a)[0x55974f83e1ea]
incorrect offsets 2303983459 16233
leaf free space ret -1023424776, leaf data size 16283, used 1023441059 nritems 584
leaf free space ret -1023424776, leaf data size 16283, used 1023441059 nritems 584
leaf free space incorrect 2234900299776 -1023424776
leaf free space ret -815266203, leaf data size 16283, used 815282486 nritems 409
leaf free space ret -815266203, leaf data size 16283, used 815282486 nritems 409
leaf free space incorrect 2234900332544 -815266203
leaf free space ret -815266203, leaf data size 16283, used 815282486 nritems 409
leaf free space ret -815266203, leaf data size 16283, used 815282486 nritems 409
leaf free space incorrect 2234900332544 -815266203
leaf free space ret -1124736152, leaf data size 16283, used 1124752435 nritems 272
leaf free space ret -1124736152, leaf data size 16283, used 1124752435 nritems 272
leaf free space incorrect 2234900561920 -1124736152
ctree.c:1720: leaf_space_used: Warning: assertion `data_len < 0` failed, value 1
btrfs-find-root(+0xb92b)[0x55974f83e92b]
btrfs-find-root(btrfs_leaf_free_space+0xd3)[0x55974f84093c]
btrfs-find-root(btrfs_check_leaf+0xef)[0x55974f840a41]
btrfs-find-root(read_tree_block+0x237)[0x55974f847dea]
btrfs-find-root(btrfs_find_root_search+0x23f)[0x55974f86bce7]
btrfs-find-root(main+0x297)[0x55974f875a94]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fc9597b3b97]
btrfs-find-root(_start+0x2a)[0x55974f83e1ea]
bad key ordering 0 1
leaf free space ret -1124736152, leaf data size 16283, used 1124752435 nritems 272
leaf free space ret -1124736152, leaf data size 16283, used 1124752435 nritems 272
leaf free space incorrect 2234900561920 -1124736152
incorrect offsets 15864 15868
incorrect offsets 15864 15868
leaf free space ret -10051, leaf data size 16283, used 26334 nritems 79
leaf free space ret -10051, leaf data size 16283, used 26334 nritems 79
leaf free space incorrect 2234900594688 -10051
leaf free space ret -198844354, leaf data size 16283, used 198860637 nritems 246
leaf free space ret -198844354, leaf data size 16283, used 198860637 nritems 246
leaf free space incorrect 2234900594688 -198844354
leaf free space ret -10051, leaf data size 16283, used 26334 nritems 79
leaf free space ret -10051, leaf data size 16283, used 26334 nritems 79
leaf free space incorrect 2234900594688 -10051
bad key ordering 0 1
bad key ordering 0 1
bad key ordering 0 1
bad key ordering 0 1
bad key ordering 0 1
bad key ordering 0 1
Superblock thinks the generation is 199897
Superblock thinks the level is 1
Well block 2234900627456(gen: 199898 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234899038208(gen: 199896 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234898726912(gen: 199895 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234898644992(gen: 199895 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234897727488(gen: 199893 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234885406720(gen: 199882 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234877542400(gen: 199881 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234882310144(gen: 199880 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234881654784(gen: 199874 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234877165568(gen: 199863 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234874789888(gen: 199863 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234874560512(gen: 199863 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234874429440(gen: 199863 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 2234874216448(gen: 199863 level: 0) seems good, but generation/level doesn't match, want gen: 199897 level: 1
...
...
...
Well block 65680605184(gen: 150 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65676771328(gen: 149 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65671888896(gen: 148 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65667973120(gen: 147 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65664057344(gen: 146 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65659895808(gen: 145 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65656487936(gen: 144 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65653243904(gen: 143 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65650130944(gen: 142 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65647165440(gen: 141 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
Well block 65644298240(gen: 140 level: 1) seems good, but generation/level doesn't match, want gen: 199897 level: 1
根据答案,我应该运行:
btrfs check --repair --tree-root <block> --super <sup>
<block>
应该是什么<sup>
?