我们有一个在 MS HyperV 环境中作为 VM 运行的 SLES12 SP1 系统。
重启后,系统将无法启动,因为 vmlinux 不再存在。Grub 说“您必须先加载 linux 内核”之类的话(我无法复制确切的错误消息)。在我深入挖掘并尝试加载旧内核后,我意识到 btrfs 系统中仍有事务挂起,至少有损坏的校验和。
所以我下载了最新的 OpenSUSE Rescue CD 并尝试挂载设备。我可以挂载主分区,但 /boot 等分区无法挂载:
linux@localhost:~> sudo mount -t btrfs -o ro,usebackuproot /dev/sda2 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.
因此我遵循了以下步骤:https://lists.opensuse.org/opensuse/2017-02/msg00930.html
安装根本不起作用,我尝试了不同的选项,例如禁用缓存等,所以清理也不起作用。
btrfs 检查说:
linux@localhost:~> sudo btrfs check /dev/sda2
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
ERROR: cannot open file system
恢复也不起作用:
linux@localhost:~> sudo btrfs restore /dev/sda2 /run/media/linux/c03ad26a-a896-468d-bf9d-9953f87b2661/Administrator/Backup_sda2/
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
Could not open root, trying backup super
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
Could not open root, trying backup super
ERROR: superblock bytenr 274877906944 is larger than device size 42952818688
Could not open root, trying backup super
所以我使用 dd 备份了图像。
超级恢复:
linux@localhost:~> sudo btrfs rescue super-recover /dev/sda2
All supers are valid, no need to recover
btrfs 救援零日志:
linux@localhost:~> sudo btrfs rescue zero-log /dev/sda2
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
ERROR: could not open ctree
块恢复也不起作用,但我还是尝试随后挂载:
linux@localhost:~> sudo btrfs rescue chunk-recover /dev/sda2
Scanning: DONE in dev0
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
open with broken chunk error
Chunk tree recovery failed
linux@localhost:~> sudo mount -t btrfs -o ro,usebackuproot /dev/sda2 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.
检查修复:
linux@localhost:~> sudo btrfs check --repair /dev/sda2
enabling repair mode
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
ERROR: cannot open file system
我得到了与 init-extent-tree 几乎相同的错误:
linux@localhost:~> sudo btrfs check --repair --init-extent-tree /dev/sda2
enabling repair mode
Checking filesystem on /dev/sda2
UUID: b70dc1a4-4c19-446c-98c9-eeee88c4fd47
Creating a new extent tree
checksum verify failed on 75638358016 found 9B64BB37 wanted 6156F702
checksum verify failed on 75638358016 found 9B64BB37 wanted 6156F702
checksum verify failed on 75638358016 found E4E3BDB6 wanted 00000000
checksum verify failed on 75638358016 found 9B64BB37 wanted 6156F702
bytenr mismatch, want=75638358016, have=267958633426704061
Error reading tree block
error pinning down used bytes
ERROR: attempt to start transaction over already running one
extent buffer leak: start 89771360256 len 16384
还有 init-csum-tree:
linux@localhost:~> sudo btrfs check --repair --init-csum-tree /dev/sda2
enabling repair mode
Creating a new CRC tree
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
checksum verify failed on 75659116544 found E4E3BDB6 wanted 00000000
checksum verify failed on 75659116544 found 61415E80 wanted 96E73A64
bytenr mismatch, want=75659116544, have=5432601639048425051
ERROR: cannot open file system
我没有找到有关此错误的更多信息,因此我尝试在 stack-exchange 上寻求帮助,因为我知道已经有一些关于此主题的问答。我们只有主机服务器的备份,所以我们真的想让它运行起来。一定有更好的方法来恢复 btrfs 分区 :(
提前致谢!