从损坏的 F2FS 分区修复或恢复文件?

从损坏的 F2FS 分区修复或恢复文件?

我有一个 f2fs 分区,缺少超级块。我制作了一个磁盘映像,这样我就不会破坏尝试修复的原始分区。

sd-repair# fsck.f2fs sd128.img 
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 249737216 (121942 MB)
    Can't find a valid F2FS superblock at 0x0
    Can't find a valid F2FS superblock at 0x1

Testdisk 不支持 F2FS。

我不知道是否有办法重写超级块,我想恢复我的文件或修复文件系统。

这是我认为是 F2FS 超级块的十六进制,来自一个好的分区

10 20 F5 F2 01 00 07 00 09 00 00 00 03 00 00 00 0C 00 00 00 09 00 
00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 
E1 0F 00 00 FF 0F 00 00 02 00 00 00 02 00 00 00 12 00 00 00 08 00 
00 00 E1 0F 00 00 00 02 00 00 00 02 00 00 00 06 00 00 00 0A 00 00 
00 2E 00 00 00 3E 00 00 03 00 00 00 01 00 00 00 02 00 00 00 31 8B 
E4 FB 13 D1 42 26 A5 07 EA 8A B6 70 A9 45 

这是我在坏分区上发现的十六进制

10 20 F5 F2 01 00 07 00 09 00 00 00 03 00 00 00 0C 00 00 00 09 00 
00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 46 DC 01 00 00 00 00 
31 ED 00 00 22 EE 00 00 02 00 00 00 06 00 00 00 72 00 00 00 77 00 
00 00 31 ED 00 00 00 02 00 00 00 02 00 00 00 06 00 00 00 12 00 00 
00 F6 00 00 00 E4 01 00 03 00 00 00 01 00 00 00 02 00 00 00 16 CD 
C2 62 53 10 46 17 A5 B7 41 C6 8E AA 33 D5 73 00 64 00 2D 00 65 00 
78 00 74 00 

超级块似乎没问题,差异是因为 1 是 128 GB 部分,而另一个是 8 GB 部分。我不知道如何判断超级块是否位于坏分区上的正确位置。据我所知,它们的偏移量不匹配。但我不太擅长使用十六进制编辑器,所以我不知道如何比较它们的偏移量。

更新:超级块的偏移量是错误的,它位于 0x600 或 3 个扇区。我从磁盘映像中删除了前 512 个字节。现在 fsck.f2fs 显示

sd-repair# fsck.f2fs -f trim_sd.img 
Info: Force to fix corruption
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 249704447 (121925 MB)
Info: MKFS version
  "Linux version 3.4.0-CM-g87d27dd (Adam@TheKeurig) (gcc version 4.9 20150123 (prerelease) 
(GCC) ) #6 SMP PREEMPT Sat Dec 17 21:28:57 CET 2016"

Info: FSCK version
  from "Linux version 4.9.0-3-amd64 ([email protected]) 
(gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) 
#1 SMP Debian 4.9.30-2 (2017-06-12)"
     to "Linux version 4.9.0-3-amd64 ([email protected])
(gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.30-2 (2017-06-12)"

Info: superblock features = 0 : 
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 249704448 (121926 MB)
[f2fs_crc_valid: 477] CRC validation failed: cal_crc = 4076150800, blk_crc = 0 buff_size = 0x0
[f2fs_crc_valid: 477] CRC validation failed: cal_crc = 4076150800, blk_crc = 0 buff_size = 0x0
[f2fs_do_mount:1945] Can't find valid checkpoint

据我所知,分区已经移动,可能是分区表有问题。所有数据似乎都完好无损。是使用ms-dos分区表。

答案1

根据您要尝试恢复的内容,您可以尝试cat sd128.img | strings [options] | grep -C10 [pattern for recovery]。但这是相当可怕的。但可以为您提供数据可能开始的线索。

此页面位于 法医维基关于 SSD 可能会很有用,尽管它主要解决了超光速(闪存过渡层),它将系统可见的块设备映射到SSD中的众多存储芯片,并自动执行磨损均衡、坏块跟踪、后台优化等。

相关内容