btrfs 检查显示校验和验证失败,即使在清理之后也是如此

btrfs 检查显示校验和验证失败,即使在清理之后也是如此

运行btrfs check出现了几个类似这样的错误(总共13个):

checksum verify failed on 369098752 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6

所有想要的校验和都是零,这显然是可疑的。

运行后,btrfs scrub我发现元数据中恰好有 13 个已更正的错误,数据块中也有多个无法更正的错误(通过从备份中恢复受影响的文件来修复)。

然而,btrfs check再次运行仍然显示同样的 13 个校验和错误。

我有两个问题:错误中的数字指的是什么?所有提到这个问题的搜索结果都没有答案。我猜它是一个逻辑地址,但btrfs inspect-internal logical-resolve number /path给出了ERROR: logical ino ioctl: No such file or directory,而且它显然也不是一个 inode(dmesg 实际上明确将这些数字称为逻辑地址,指向元数据叶子,但它没有指定是什么类型)。

第二个问题,我能对这些校验和做些什么?所有 btrfs 问题都可以通过运行迅速得到解决,btrfs check --init-csum-tree但我的理解是这将完全重置 csum 树,我想首先了解问题到底出在哪里。

文件系统信息:

[root@ls-fedora ArchiMedia]# btrfs filesystem usage .
Overall:
    Device size:          27.28TiB
    Device allocated:         12.02TiB
    Device unallocated:       15.27TiB
    Device missing:          0.00B
    Used:             11.84TiB
    Free (estimated):         15.44TiB  (min: 7.80TiB)
    Free (statfs, df):        15.44TiB
    Data ratio:               1.00
    Metadata ratio:           2.00
    Global reserve:      512.00MiB  (used: 0.00B)
    Multiple profiles:              no

Data,single: Size:11.82TiB, Used:11.65TiB (98.57%)
   /dev/mapper/ArchiMedia     11.82TiB

Metadata,RAID1: Size:102.00GiB, Used:100.80GiB (98.82%)
   /dev/mapper/ArchiMedia    102.00GiB
   /dev/mapper/AM-2  102.00GiB

System,RAID1: Size:32.00MiB, Used:1.30MiB (4.05%)
   /dev/mapper/ArchiMedia     32.00MiB
   /dev/mapper/AM-2   32.00MiB

Unallocated:
   /dev/mapper/ArchiMedia      4.45TiB
   /dev/mapper/AM-2   10.81TiB

完整btrfs check输出:

[root@ls-fedora ~]# btrfs check -p /dev/mapper/ArchiMedia 
Opening filesystem to check...
Checking filesystem on /dev/mapper/ArchiMedia
UUID: 6e222b94-0fa2-237d-284c-176e55472e30
[1/7] checking root items                      (0:06:50 elapsed, 17461366 items checked)
checksum verify failed on 369098752 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369115136 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369131520 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369147904 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932944896 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932961280 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932977664 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932994048 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962933010432 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x929dbce6274a6515cb28dcc6e1a5ee75bfdd7247c15ca701b2d272c358d1c544
checksum verify failed on 5964006686720 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006703104 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006719488 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006735872 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
[2/7] checking extents                         (0:17:42 elapsed, 6613880 items checked)
[3/7] checking free space cache                (0:06:57 elapsed, 12204 items checked)
checksum verify failed on 5962933010432 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x929dbce6274a6515cb28dcc6e1a5ee75bfdd7247c15ca701b2d272c358d1c544
checksum verify failed on 5962932994048 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932944896 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932961280 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932977664 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006686720 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006703104 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006719488 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006735872 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369098752 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369115136 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369147904 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369131520 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
[4/7] checking fs roots                        (1:18:02 elapsed, 129168 items checked)
checksum verify failed on 5962933010432 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x929dbce6274a6515cb28dcc6e1a5ee75bfdd7247c15ca701b2d272c358d1c544
checksum verify failed on 5962932994048 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932944896 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932961280 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5962932977664 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006686720 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006703104 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006719488 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 5964006735872 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369098752 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369115136 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369147904 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
checksum verify failed on 369131520 wanted 0x0000000000000000000000000000000000000000000000000000000000000000 found 0x6290e6592047ec80140a1252d31a8ba8a33a34cf578b5c8c4a081706b9416fa6
[5/7] checking csums (without verifying data)  (1:10:29 elapsed, 25512445 items checked)
[6/7] checking root refs                       (0:00:00 elapsed, 4 items checked)
[7/7] checking quota groups skipped (not enabled on this FS)
found 12933797396480 bytes used, no error found
total csum bytes: 100175282368
total tree bytes: 108361662464
total fs tree bytes: 2123726848
total extent tree bytes: 1481572352
btree space waste bytes: 3398233945
file data blocks allocated: 15714799702016
 referenced 13476542222336

dmesg 行对应的地址:

[ 6663.817055] BTRFS info (device dm-1): scrub: started on devid 1
[ 6663.818097] BTRFS info (device dm-1): scrub: started on devid 2
[ 6683.992056] BTRFS warning (device dm-1): checksum error at logical 5962932944896 on dev /dev/mapper/AM-2, physical 1498415104: metadata leaf (level 0) in tree 7
[ 6683.992079] BTRFS warning (device dm-1): checksum error at logical 5962932944896 on dev /dev/mapper/AM-2, physical 1498415104: metadata leaf (level 0) in tree 7
[ 6683.992092] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 22, gen 0
[ 6683.992254] BTRFS warning (device dm-1): checksum error at logical 5962932961280 on dev /dev/mapper/AM-2, physical 1498431488: metadata leaf (level 0) in tree 7
[ 6683.992263] BTRFS warning (device dm-1): checksum error at logical 5962932961280 on dev /dev/mapper/AM-2, physical 1498431488: metadata leaf (level 0) in tree 7
[ 6683.992270] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 23, gen 0
[ 6683.992477] BTRFS warning (device dm-1): checksum error at logical 5962932977664 on dev /dev/mapper/AM-2, physical 1498447872: metadata leaf (level 0) in tree 7
[ 6683.992485] BTRFS warning (device dm-1): checksum error at logical 5962932977664 on dev /dev/mapper/AM-2, physical 1498447872: metadata leaf (level 0) in tree 7
[ 6683.992492] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 24, gen 0
[ 6683.992647] BTRFS warning (device dm-1): checksum error at logical 5962932994048 on dev /dev/mapper/AM-2, physical 1498464256: metadata leaf (level 0) in tree 7
[ 6683.992653] BTRFS warning (device dm-1): checksum error at logical 5962932994048 on dev /dev/mapper/AM-2, physical 1498464256: metadata leaf (level 0) in tree 7
[ 6683.992663] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 25, gen 0
[ 6683.997006] BTRFS warning (device dm-1): checksum error at logical 5962933010432 on dev /dev/mapper/AM-2, physical 1498480640: metadata leaf (level 0) in tree 7
[ 6683.997028] BTRFS warning (device dm-1): checksum error at logical 5962933010432 on dev /dev/mapper/AM-2, physical 1498480640: metadata leaf (level 0) in tree 7
[ 6683.997041] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 26, gen 0
[ 6702.992865] BTRFS warning (device dm-1): checksum error at logical 5964006686720 on dev /dev/mapper/AM-2, physical 2572156928: metadata leaf (level 0) in tree 7
[ 6702.992880] BTRFS warning (device dm-1): checksum error at logical 5964006686720 on dev /dev/mapper/AM-2, physical 2572156928: metadata leaf (level 0) in tree 7
[ 6702.992888] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 27, gen 0
[ 6702.992985] BTRFS warning (device dm-1): checksum error at logical 5964006703104 on dev /dev/mapper/AM-2, physical 2572173312: metadata leaf (level 0) in tree 7
[ 6702.992990] BTRFS warning (device dm-1): checksum error at logical 5964006703104 on dev /dev/mapper/AM-2, physical 2572173312: metadata leaf (level 0) in tree 7
[ 6702.992994] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 28, gen 0
[ 6702.993083] BTRFS warning (device dm-1): checksum error at logical 5964006719488 on dev /dev/mapper/AM-2, physical 2572189696: metadata leaf (level 0) in tree 7
[ 6702.993086] BTRFS warning (device dm-1): checksum error at logical 5964006719488 on dev /dev/mapper/AM-2, physical 2572189696: metadata leaf (level 0) in tree 7
[ 6702.993090] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 29, gen 0
[ 6702.993177] BTRFS warning (device dm-1): checksum error at logical 5964006735872 on dev /dev/mapper/AM-2, physical 2572206080: metadata leaf (level 0) in tree 7
[ 6702.993181] BTRFS warning (device dm-1): checksum error at logical 5964006735872 on dev /dev/mapper/AM-2, physical 2572206080: metadata leaf (level 0) in tree 7
[ 6702.993185] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 30, gen 0
[ 6721.512615] BTRFS warning (device dm-1): checksum error at logical 369098752 on dev /dev/mapper/AM-2, physical 3645898752: metadata leaf (level 0) in tree 7
[ 6721.512627] BTRFS warning (device dm-1): checksum error at logical 369098752 on dev /dev/mapper/AM-2, physical 3645898752: metadata leaf (level 0) in tree 7
[ 6721.512633] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 31, gen 0
[ 6721.512703] BTRFS warning (device dm-1): checksum error at logical 369115136 on dev /dev/mapper/AM-2, physical 3645915136: metadata leaf (level 0) in tree 7
[ 6721.512707] BTRFS warning (device dm-1): checksum error at logical 369115136 on dev /dev/mapper/AM-2, physical 3645915136: metadata leaf (level 0) in tree 7
[ 6721.512709] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 32, gen 0
[ 6721.512775] BTRFS warning (device dm-1): checksum error at logical 369131520 on dev /dev/mapper/AM-2, physical 3645931520: metadata leaf (level 0) in tree 7
[ 6721.512777] BTRFS warning (device dm-1): checksum error at logical 369131520 on dev /dev/mapper/AM-2, physical 3645931520: metadata leaf (level 0) in tree 7
[ 6721.512780] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 33, gen 0
[ 6721.516630] BTRFS warning (device dm-1): checksum error at logical 369147904 on dev /dev/mapper/AM-2, physical 3645947904: metadata leaf (level 0) in tree 7
[ 6721.516655] BTRFS warning (device dm-1): checksum error at logical 369147904 on dev /dev/mapper/AM-2, physical 3645947904: metadata leaf (level 0) in tree 7
[ 6721.516668] BTRFS error (device dm-1): bdev /dev/mapper/AM-2 errs: wr 29, rd 0, flush 0, corrupt 34, gen 0
[ 6771.128355] BTRFS error (device dm-1): bad tree block start, want 5962933010432 have 0
[ 6771.157972] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933010432 (dev /dev/mapper/AM-2 sector 2926720)
[ 6771.157979] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933014528 (dev /dev/mapper/AM-2 sector 2926728)
[ 6771.159093] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933018624 (dev /dev/mapper/AM-2 sector 2926736)
[ 6771.159422] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933022720 (dev /dev/mapper/AM-2 sector 2926744)
[ 6913.335267] BTRFS warning (device dm-1): checksum error at logical 43113840640 on dev /dev/mapper/ArchiMedia, physical 44184436736, root 5, inode 4981, offset 131072, length 4096, links 1 (path: Archive/Develop/SDKs/Mobile/Android/android-sdk-windows/docs/reference/android/widget/MediaController.html)
[ 6913.335277] BTRFS error (device dm-1): bdev /dev/mapper/ArchiMedia errs: wr 0, rd 0, flush 0, corrupt 135, gen 0
[ 7229.380941] BTRFS error (device dm-1): bad tree block start, want 5962932994048 have 0
[ 7229.425140] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932994048 (dev /dev/mapper/AM-2 sector 2926688)
[ 7229.425160] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932998144 (dev /dev/mapper/AM-2 sector 2926696)
[ 7229.425170] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933002240 (dev /dev/mapper/AM-2 sector 2926704)
[ 7229.425176] BTRFS info (device dm-1): read error corrected: ino 0 off 5962933006336 (dev /dev/mapper/AM-2 sector 2926712)
[ 7241.946885] BTRFS error (device dm-1): bad tree block start, want 5962932944896 have 0
[ 7241.982749] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932944896 (dev /dev/mapper/AM-2 sector 2926592)
[ 7241.982775] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932948992 (dev /dev/mapper/AM-2 sector 2926600)
[ 7241.982788] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932953088 (dev /dev/mapper/AM-2 sector 2926608)
[ 7241.982797] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932957184 (dev /dev/mapper/AM-2 sector 2926616)
[ 7314.107076] BTRFS error (device dm-1): bad tree block start, want 5962932961280 have 0
[ 7314.131362] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932961280 (dev /dev/mapper/AM-2 sector 2926624)
[ 7314.131386] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932965376 (dev /dev/mapper/AM-2 sector 2926632)
[ 7314.131396] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932969472 (dev /dev/mapper/AM-2 sector 2926640)
[ 7314.131403] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932973568 (dev /dev/mapper/AM-2 sector 2926648)
[ 7353.926345] BTRFS error (device dm-1): bad tree block start, want 5962932977664 have 0
[ 7353.964151] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932977664 (dev /dev/mapper/AM-2 sector 2926656)
[ 7353.964169] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932981760 (dev /dev/mapper/AM-2 sector 2926664)
[ 7353.964178] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932985856 (dev /dev/mapper/AM-2 sector 2926672)
[ 7353.964185] BTRFS info (device dm-1): read error corrected: ino 0 off 5962932989952 (dev /dev/mapper/AM-2 sector 2926680)

答案1

阅读了大量文档和搜索结果后,我发现:

  1. btrfs check在错误中给出逻辑地址
  2. 运行btrfs scrub提到树 7,这是一个校验和树(btrfs inspect-internal dump-tree -t 7 -r确认)
  3. 您可以使用以下方式获取相关的数据偏移量btrfs inspect-internal dump-tree -t 7 -b <logical_address> /dev/<dev>
  4. 您可以使用以下方法从数据偏移量获取关联文件名btrfs inspect-internal logical-resolve <data_offset> /<mounted_fs_path>

您可以删除文件以删除校验和树中的损坏条目。

您还可以挂载文件系统并将mount -t btrfs -o ro,rescue=ignoredatacsums /dev/<dev> /<mount_path>受影响的文件复制到其他位置(通常需要注意的是数据可能会损坏)。

这是我编写的用于半自动获取它的小型 pwsh 脚本:

#!/usr/bin/pwsh


$dev = "mapper/AM-2"
$mnt = "/mnt/ArchiMedia"
$csum_offsets = @(369098752, 369115136, 369131520, 369147904, 5962932944896, 5962932961280, 5962932977664, 5962932994048, 5962933010432, 5964006686720, 5964006703104, 5964006719488, 5964006735872)

$result = @()
foreach ($o in $csum_offsets)
{
    $output = (btrfs inspect-internal dump-tree -t 7 -b $o "/dev/$dev")
    $selected = ($output | Select-String -Pattern 'range start (\d+) end' -AllMatches)
    foreach ($m in $selected.Matches)
    {
        $data_offset = $m.Groups[1].Value
        $fname = (btrfs inspect-internal logical-resolve $data_offset $mnt)
        $result += $fname
    }
}
Write-Host "Affected files:"
$result | Get-Unique | Sort-Object

相关内容