btrfs,强制重新计算错误校验和

btrfs,强制重新计算错误校验和

一个 USB 连接的大型 HDD,其中btrfs包含一个 1TB 文件(磁盘映像)。btrfs scrub写入该文件后,第一个发现该文件中间某处出现了 3 个逻辑坏块:

[ 7702.964265] BTRFS warning (device sdd1): checksum error at logical
5473719291904 on dev /dev/sdd1, sector 222940168, root 5, inode 1245769,
offset 97110921216, length 4096, links 1 (path: dysk/dysk.bin)
[ 7702.964274] BTRFS error (device sdd1): bdev /dev/sdd1 errs: wr 0,
rd 0, flush 0, corrupt 17, gen 0
[ 7702.964278] BTRFS error (device sdd1): unable to fixup (regular) error
at logical 5473719291904 on dev /dev/sdd1
[…]
[ 9588.625906] BTRFS warning (device sdd1): checksum error at logical
5241172611072 on dev /dev/sdd1, sector 691494312, root 5, inode 1245769,
offset 310632271872, length 4096, links 1 (path: dysk/dysk.bin)
[ 9588.625916] BTRFS error (device sdd1): bdev /dev/sdd1 errs: wr 0,
rd 0, flush 0, corrupt 18, gen 0
[ 9588.625920] BTRFS error (device sdd1): unable to fixup (regular) error
at logical 5241172611072 on dev /dev/sdd1
[…]
[20545.302898] BTRFS warning (device sdd1): checksum error at logical
3991747321856 on dev /dev/sdd1, sector 3185809200, root 5, inode 1245769,
offset 907925676032, length 4096, links 1 (path: dysk/dysk.bin)
[20545.302908] BTRFS error (device sdd1): bdev /dev/sdd1 errs: wr 0,
rd 0, flush 0, corrupt 19, gen 0
[20545.302912] BTRFS error (device sdd1): unable to fixup (regular) error
at logical 3991747321856 on dev /dev/sdd1

此文件没有备份,因此无法完美恢复。btrfs 分区的整个区域都可以读取而不会出现 I/O 错误,因此我认为有两种可能的情况:要么数据块写入不正确(无法恢复),要么存储了错误的校验和(修复应该很简单:重新计算校验和)。鉴于第一种情况已经丢失,我该如何要求btrfs重新计算数据块的校验和?

相关内容