opensuse-leap-15.1 无法启动, btrfs 损坏, 如何修复?

我在 win10 的 vmware 虚拟机里安装的 opensuse-leap-15.1, 在更新 opensuse-leap-15.1 软件包的过程中 win10 蓝屏了, 重启后发现进入虚拟机是 GRUB Loading 界面

我尝试引导启动发现 file ‘/’ not found 错误

grub rescue> set root=(hd0,2)
grub rescue> set prefix=(hd0,2)/boot/grub
grub rescue> insmod normal
error: file '/' not found.

然后我进入 iso 的救援模式尝试修复文件系统

但是没有成功.
3f17c5dff0a36470075d16940e757d5

我应该如何处理?

@suseuer

照这个试试

在 iso 的救援模式中没有 btrfs-find-root 命令
image

去这里下 btrfsprogs-static 然后放到 U 盘里用

https://download.opensuse.org/repositories/filesystems/openSUSE_Tumbleweed/x86_64/

btrfs-find-root 的输出结果为:

tty1:rescue:~ # btrfs-find-root /dev/sda2
Superblock thinks the generation is 56680
Superblock thinks the level is 1
Well block 225181696 (gen: 56681 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 214040576 (gen: 56680 level: 0) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 213942272 (gen: 56680 level: 0) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 226394112 (gen: 56660 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 79822848 (gen: 56654 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 23129915392 (gen: 56653 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 23082401792 (gen: 56336 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 22903619584 (gen: 56260 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 22844997632 (gen: 56259 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 22859546624 (gen: 56258 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 411140096 (gen: 56252 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 400850944 (gen: 56251 level: 0) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 815202304 (gen: 56250 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 777240576 (gen: 56235 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 776798208 (gen: 56234 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 774209536 (gen: 56228 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 773586944 (gen: 56227 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 773341184 (gen: 56226 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 750632960 (gen: 56180 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 750321664 (gen: 56179 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 749928448 (gen: 56178 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 749568000 (gen: 56177 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 748797952 (gen: 56175 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 748306432 (gen: 56174 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 739393536 (gen: 56155 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 739508224 (gen: 56154 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 734969856 (gen: 56144 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 734347264 (gen: 56143 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 724140032 (gen: 56121 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 715456512 (gen: 56103 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 712687616 (gen: 56098 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 712474624 (gen: 56097 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 711720960 (gen: 56095 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 702005248 (gen: 56074 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
Well block 699465728 (gen: 56073 level: 1) seems good, but generation/level doesn't match, want gen: 56680 level: 1
......

我提取其中的 gen 值生成三个脚本
super0.sh:

btrfs check --tree-root 56681 --super 0 /dev/sda2 || \
btrfs check --tree-root 56680 --super 0 /dev/sda2 || \
btrfs check --tree-root 56680 --super 0 /dev/sda2 || \
btrfs check --tree-root 56660 --super 0 /dev/sda2 || \
btrfs check --tree-root 56654 --super 0 /dev/sda2 || \
btrfs check --tree-root 56653 --super 0 /dev/sda2 || \
btrfs check --tree-root 56336 --super 0 /dev/sda2 || \
btrfs check --tree-root 56260 --super 0 /dev/sda2 || \
btrfs check --tree-root 56259 --super 0 /dev/sda2 || \
btrfs check --tree-root 56258 --super 0 /dev/sda2 || \
......

super1.sh:

btrfs check --tree-root 56681 --super 1 /dev/sda2 || \
btrfs check --tree-root 56680 --super 1 /dev/sda2 || \
btrfs check --tree-root 56680 --super 1 /dev/sda2 || \
btrfs check --tree-root 56660 --super 1 /dev/sda2 || \
btrfs check --tree-root 56654 --super 1 /dev/sda2 || \
btrfs check --tree-root 56653 --super 1 /dev/sda2 || \
btrfs check --tree-root 56336 --super 1 /dev/sda2 || \
btrfs check --tree-root 56260 --super 1 /dev/sda2 || \
btrfs check --tree-root 56259 --super 1 /dev/sda2 || \
btrfs check --tree-root 56258 --super 1 /dev/sda2 || \
......

super2.sh:

btrfs check --tree-root 56681 --super 2 /dev/sda2 || \
btrfs check --tree-root 56680 --super 2 /dev/sda2 || \
btrfs check --tree-root 56680 --super 2 /dev/sda2 || \
btrfs check --tree-root 56660 --super 2 /dev/sda2 || \
btrfs check --tree-root 56654 --super 2 /dev/sda2 || \
btrfs check --tree-root 56653 --super 2 /dev/sda2 || \
btrfs check --tree-root 56336 --super 2 /dev/sda2 || \
btrfs check --tree-root 56260 --super 2 /dev/sda2 || \
btrfs check --tree-root 56259 --super 2 /dev/sda2 || \
btrfs check --tree-root 56258 --super 2 /dev/sda2 || \
......

super0.sh 执行的结果为 return0.txt:

ERROR: tree block bytenr 56681 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 0, bytenr 65536
Opening filesystem to check...
ERROR: tree block bytenr 56680 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 0, bytenr 65536
Opening filesystem to check...
ERROR: tree block bytenr 56680 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 0, bytenr 65536
Opening filesystem to check...
ERROR: tree block bytenr 56660 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 0, bytenr 65536
Opening filesystem to check...
ERROR: tree block bytenr 56654 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 0, bytenr 65536
Opening filesystem to check...
ERROR: tree block bytenr 56653 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
......

super1.sh 执行的结果为 return1.txt:

ERROR: tree block bytenr 56681 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 1, bytenr 67108864
Opening filesystem to check...
ERROR: tree block bytenr 56680 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 1, bytenr 67108864
Opening filesystem to check...
ERROR: tree block bytenr 56680 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 1, bytenr 67108864
Opening filesystem to check...
ERROR: tree block bytenr 56660 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 1, bytenr 67108864
Opening filesystem to check...
ERROR: tree block bytenr 56654 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
using SB copy 1, bytenr 67108864
Opening filesystem to check...
ERROR: tree block bytenr 56653 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system
......

super2.sh 执行的结果为 return2.txt:

ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
using SB copy 2, bytenr 274877906944
Opening filesystem to check...
ERROR: superblock bytenr 274877906944 is larger than device size 30054285312
ERROR: cannot open file system
......

我应该如何处理?

如果需要上述 super 文件 或 return 文件, 可以提供.

试试用这个命令挂载:mount -o recovery /dev/sdX /your/mountpoint
据说这样会选择一个偏旧的,但是能挂载的 root

btrfs check 尝试修复文件系统,但加上 --repair 选项时才真正执行修复 ,建议你备份以下虚拟盘,再试试加--repair选项。反正虚拟盘,备份后不怕数据损坏。

mount -o recovery /dev/sdX /your/mountpoint 也不行

我在三个 super 文件中的指令加入 --repair, 但是输出和之前三个 return 文件相同, 都是错误提示, 无法修复.

它都不觉得这是 btrfs,可能你数据丢的太多。这不是(对于虚拟机)更新时断电能出的问题。估计 win 的蓝屏与磁盘相关,试试检查一下主机的文件系统吧。

看来 btrfs 理想很丰满,但是想用好,还需要自己对她很了解。
如此看来,我还是用 ext4 巴

试一下 btrfs rescue super-recover -v /dev/sda2
来源:https://xpenology.com/forum/topic/13538-how-to-recover-data-from-a-crashed-btrfs-drive-help-request/
我觉得症状差不多,建议先备份虚拟盘,用备份试一下。

https://ownyourbits.com/2019/03/03/how-to-recover-a-btrfs-partition/