昨天,我无法挂载用 btrfs 格式化的可移动磁盘。
Kenel 消息(dmesg
输出):
[38257.314422] BTRFS info (device sdd): disk space caching is enabled
[38257.328731] BTRFS critical (device sdd): corrupt node: root=1 block=1264662233088 slot=29, bad key order, current (18446744073709551605 0 666286161920) next (18446744073709551605 0 534752788480)
[38257.552619] BTRFS critical (device sdd): corrupt node: root=1 block=1264662233088 slot=29, bad key order, current (18446744073709551605 0 666286161920) next (18446744073709551605 0 534752788480)
[38257.552648] BTRFS warning (device sdd): failed to read tree root
[38257.586065] BTRFS error (device sdd): open_ctree failed
我尝试用以下方法修复btrfs check --repair <dev>
:
$ sudo btrfs check --repair /dev/sdc
enabling repair mode
Couldn't setup extent tree
Couldn't setup device tree
ERROR: cannot open file system
输出btrfs rescue super-recover -v
:
vivodo@esper:~|⇒ sudo btrfs rescue super-recover -v /dev/sdd
All Devices:
Device: id = 1, name = /dev/sdd
Before Recovering:
[All good supers]:
device name = /dev/sdd
superblock bytenr = 65536
device name = /dev/sdd
superblock bytenr = 67108864
device name = /dev/sdd
superblock bytenr = 274877906944
[All bad supers]:
All supers are valid, no need to recover
输出btrfs-find-root <dev>
vivodo@esper:~|⇒ sudo btrfs-find-root /dev/sdd
Couldn't setup extent tree
Couldn't setup device tree
Superblock thinks the generation is 665862
Superblock thinks the level is 1
Found tree root at 1264662233088 gen 665862 level 1
Well block 1264657760256(gen: 665852 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1264501325824(gen: 665851 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1264444915712(gen: 665850 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1264415211520(gen: 665849 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 883160006656(gen: 665848 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 883047071744(gen: 665847 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 882929369088(gen: 665846 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 882774835200(gen: 665845 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 882735235072(gen: 665844 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 818615599104(gen: 665843 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 818267537408(gen: 665842 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689318658048(gen: 665841 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689093099520(gen: 665840 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689090789376(gen: 665839 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689089036288(gen: 665839 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689088970752(gen: 665839 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689087004672(gen: 665839 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689086480384(gen: 665839 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689067638784(gen: 665838 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 688861003776(gen: 665837 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1030029312(gen: 665836 level: 1) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689096589312(gen: 665835 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 689096507392(gen: 665835 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 688995008512(gen: 665834 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 537983500288(gen: 24399 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 537974210560(gen: 24398 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1096957952(gen: 24397 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1083883520(gen: 24397 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1082195968(gen: 24397 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1071366144(gen: 24397 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 688859529216(gen: 24378 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 538319437824(gen: 24377 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 538387202048(gen: 24326 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 538081050624(gen: 24325 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1264396353536(gen: 24320 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 1264387932160(gen: 24320 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 538474037248(gen: 24250 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 882884788224(gen: 24183 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 538079313920(gen: 23195 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 4243456(gen: 3 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
Well block 4194304(gen: 2 level: 0) seems good, but generation/level doesn't match, want gen: 665862 level: 1
我试过btrfs recue chunk-recover -y <dev>
:
vivodo@esper:~|⇒ time sudo btrfs rescue chunk-recover -y /dev/sdd
Scanning: DONE in dev0
Couldn't setup extent tree
open with broken chunk error
Chunk tree recovery failed
sudo btrfs rescue chunk-recover -y /dev/sdd 161.89s user 2496.23s system 7% cpu 9:29:51.66 total
最后,我仍然无法挂载该磁盘,并出现“错误的 fs 类型”错误:
vivodo@esper:~|⇒ sudo mount /dev/sdd /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdd, missing codepage or helper program, or other error.
vivodo@esper:~|⇒ sudo mount -t btrfs -o compress=lzo /dev/sdd /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdd, missing codepage or helper program, or other error.
我还能做什么来挽救我的 btrfs 磁盘?
附言,ArchLinux 维基说“systemd 或 mkinitcpio 中有一个错误,导致在具有多设备 Btrfs 文件系统的系统上使用 mkinitcpio.conf 中的 btrfs 挂钩时出现以下错误”... 我的主机中有多个 btrfs 文件系统,但它们不相关。也许事实并非如此。