我的工作站的主磁盘开始出现故障,我认为使用 btrfs 平衡两者之间的 ssd 制作镜像是一个好主意。我的错误:在系统崩溃之前我没有尝试检查 ssd 副本。
现在我有一个带有 btrfs 分区的 SSD,我无法挂载它。
在另一台电脑上,我尝试安装该分区,但出现错误
mount -t btrfs -o degraded,nospace_cache,clear_cache /dev/sda1 /a
mount: /a: special device /dev/sdb1 does not exist.
查看 dmesg 以获取更多信息
dmesg
[ 1379.121902] BTRFS info (device sda1): first mount of filesystem 6d3d6859-f4ab-4b16-82b0
[ 1379.121938] BTRFS info (device sda1): using crc32c (crc32c-intel) checksum algorithm
[ 1379.121951] BTRFS info (device sda1): allowing degraded mounts
[ 1379.121958] BTRFS info (device sda1): disabling disk space caching
[ 1379.121962] BTRFS info (device sda1): force clearing of disk cache
[ 1379.124362] BTRFS warning (device sda1): devid 1 uuid 7b12149e-bf09-47df-ac28 is missing
[ 1379.124378] BTRFS error (device sda1): device total_bytes should be at most 450106813952 but found 500106813440
[ 1379.124391] BTRFS error (device sda1): failed to read chunk tree: -22
[ 1379.125215] BTRFS error (device sda1): open_ctree failed
然后我尝试检查
# btrfs check --readonly /dev/sda1
Opening filesystem to check...
warning, device 1 is missing
Checking filesystem on /dev/sda1
UUID: 6d3d6859-f4ab-4b16-82b0-15a368f4529a
[1/7] checking root items
bad tree block 39742701568, bytenr mismatch, want=39742701568, have=0
ERROR: failed to repair root items: Input/output error
[2/7] checking extents
bad tree block 39334887424, bytenr mismatch, want=39334887424, have=0
bad tree block 39742701568, bytenr mismatch, want=39742701568, have=0
bad tree block 39744208896, bytenr mismatch, want=39744208896, have=0
.....
.....
尝试验证设备大小,似乎无法仅使用一个磁盘进行纠正
# btrfs rescue fix-device-size /dev/sda1
warning, device 1 is missing
ERROR: devid 1 is missing or not writeable
ERROR: fixing device size needs all device(s) to be present and writeable
并且所有 balance 命令似乎都需要挂载文件系统,而我没有
检查超级块思维可能有助于解决 ctree 问题,但似乎没有必要
# btrfs rescue super-recover /dev/sda1
All supers are valid, no need to recover
关于超级块恢复
# btrfs-find-root /dev/sda1
warning, device 1 is missing
Superblock thinks the generation is 342723441
Superblock thinks the level is 1
Found tree root at 445358817280 gen 342723441 level 1
Well block 445358096384(gen: 342723440 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445344907264(gen: 342723432 level: 0) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445325819904(gen: 342723404 level: 0) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445322395648(gen: 342723399 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445322477568(gen: 342723398 level: 0) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445318283264(gen: 342723392 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445317906432(gen: 342723391 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445317840896(gen: 342723390 level: 0) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445299900416(gen: 342723359 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
Well block 445298950144(gen: 342723358 level: 1) seems good, but generation/level doesn't match, want gen: 342723441 level: 1
.....
.....
看起来有些不对劲,但我认为 mount 选项中的 clear_cache 解决了这种“生成”问题。我显然在这里忽略了很多想法。
我不知道如何恢复该磁盘。
欢迎对错误之处和如何改正提出任何提示。
姆夫