使用 ddrescue 和 testdisk 恢复损坏的硬盘文件系统

使用 ddrescue 和 testdisk 恢复损坏的硬盘文件系统

在处理部分救援的分区后,我被告知要使用来ddrescue保存发生故障的外部硬盘驱动器,然后应用testdisk它来完成救援操作。尽管该驱动器几乎已完全保存到第二个驱动器上(由于我在特别讨厌的点击声中仓促删除并随后插入 Windows 分区),testdisk 似乎仍然将新驱动器视为“有缺陷”。更具体地说,Quick Search仅返回少数文件夹和文件,而日志特别提到了Bad Relative Sector.我想知道我应该采取哪些进一步的步骤,因为我被告知我现在的可能性是:

  1. 重做 ddrescue 尝试,让它完全完成并希望 testdisk 重新创建文件系统;
  2. 在救援的驱动器上使用 Photorec 并希望从中获取尽可能多的项目;
  3. 使用其他工具恢复我的数据。此外,我还被告知要寻求更详细的解决方案https://forum.cgsecurity.org/phpBB3/viewtopic.php?t=12307以及。

以下是 ddrescue 操作的日志摘录(完整日志太大,可以在此处找到https://pastebin.com/mCi0DgEi):

Rescue Logfile. Created by GNU ddrescue version 1.19
# Command line: ddrescue -f /dev/sdc /dev/sdb /home/marco/Desktop/log1.log

# Start time:   2023-03-28 23:06:35
# Current time: 2023-04-03 17:29:58
# Scraping failed blocks... (forwards)
# current_pos  current_status
0xC6DC9200     /
#      pos        size  status
0x00000000  0x586DF000  +
0x586DF000  0x0000D000  -
0x586EC000  0x67F48000  +
0xC0634000  0x00720000  -
0xC0D54000  0x00034000  +
0xC0D88000  0x00001000  -
0xC0D89000  0x00009000  +
0xC0D92000  0x00001000  -
0xC0D93000  0x0002B000  +
0xC0DBE000  0x00008000  -
0xC0DC6000  0x00001000  +
0xC0DC7000  0x00001000  -
0xC0DC8000  0x00ABC000  +
0xC1884000  0x00001000  -
0xC1885000  0x0000A000  +
0xC188F000  0x00001000  -
0xC1890000  0x002CA000  +
0xC1B5A000  0x00001000  -
0xC1B5B000  0x005FF000  +
0xC215A000  0x00001000  -
......................
0xAAC1E54200  0x00002C00  /
0xAAC1E56E00  0x00000200  -
0xAAC1E57000  0x003B1000  +
0xAAC2208000  0x00000200  -
0xAAC2208200  0x00000C00  /
0xAAC2208E00  0x00000200  -
0xAAC2209000  0x00317000  +
0xAAC2520000  0x00000200  -
0xAAC2520200  0x00000C00  /
0xAAC2520E00  0x00000200  -
0xAAC2521000  0x0001C000  +
0xAAC253D000  0x00000200  -
0xAAC253D200  0x00000C00  /
0xAAC253DE00  0x00000200  -
0xAAC253E000  0x00077000  +
0xAAC25B5000  0x00000200  -
0xAAC25B5200  0x00003C00  /
0xAAC25B8E00  0x00000200  -
0xAAC25B9000  0x0008F000  +
0xAAC2648000  0x00000200  -
0xAAC2648200  0x00000C00  /
0xAAC2648E00  0x00000200  -
0xAAC2649000  0x11CDF4CE000  +
0x1C7A1B17000  0x00000200  -
0x1C7A1B17200  0x00000C00  /
0x1C7A1B17E00  0x00000200  -
0x1C7A1B18000  0x00099000  +
0x1C7A1BB1000  0x00000200  -
0x1C7A1BB1200  0x00000C00  /
0x1C7A1BB1E00  0x00000200  -
0x1C7A1BB2000  0x2CD9ED000  +
0x1CA6F59F000  0x00000200  -
0x1CA6F59F200  0x00000C00  /
0x1CA6F59FE00  0x00000200  -
0x1CA6F5A0000  0x751B76000  +`

另外,这是testdisk的部分输出:

` 2023 年 4 月 3 日星期一 22:54:40 命令行:TestDisk /log /debug

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <[email protected]>
http://www.cgsecurity.org
OS: Linux, kernel 4.15.0-142-generic (#146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021) x86_64
Compiler: GCC 5.3
ext2fs lib: 1.42.13, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.0
/dev/sda: LBA, HPA, LBA48, DCO support
/dev/sda: size       625142448 sectors
/dev/sda: user_max   625142448 sectors
/dev/sda: native_max 625142448 sectors
Warning: can't get size for Disk /dev/mapper/control - 0 B - 0 sectors, sector size=512
Hard disk list
Disk /dev/sda - 320 GB / 298 GiB - CHS 38913 255 63, sector size=512 - WDC WD3200BPVT-80JJ5T0, S/N:WD-WXU1EA1LJZPV, FW:01.01A01
Disk /dev/sdb - 2000 GB / 1863 GiB - CHS 243201 255 63, sector size=512 - TOSHIBA EXTERNAL_USB

Partition table type (auto): Intel
Disk /dev/sdb - 2000 GB / 1863 GiB - TOSHIBA EXTERNAL_USB
Partition table type: Intel

Analyse Disk /dev/sdb - 2000 GB / 1863 GiB - CHS 243201 255 63
Geometry from i386 MBR: head=255 sector=63
BAD_RS LBA=2048 63
NTFS at 0/32/33
Current partition structure:
 1 * HPFS - NTFS              0  32 33 243201  48 31 3907025072

Bad relative sector.
Record 5617 has wrong SeqNo (1 <> 2)

search_part()
Disk /dev/sdb - 2000 GB / 1863 GiB - CHS 243201 255 63
NTFS at 0/32/33
filesystem size           3907025072
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     HPFS - NTFS              0  32 33 243201  48 31 3907025072
     NTFS, blocksize=4096, 2000 GB / 1863 GiB

Results
   * HPFS - NTFS              0  32 33 243201  78 13 3907026944
     NTFS, blocksize=4096, 2000 GB / 1863 GiB

Hint for advanced users. dmsetup may be used if you prefer to avoid to rewrite the partition table for the moment:
echo "0 3907026944 linear /dev/sdb 2048" | dmsetup create test0
ntfs_device_testdisk_io_ioctl() unimplemented
NTFS Volume is dirty.


dir_partition inode=5
   * HPFS - NTFS              0  32 33 243201  78 13 3907026944
     NTFS, blocksize=4096, 2000 GB / 1863 GiB
ntfs_readdir failed for cluster 5: Input/output error
Directory /
       5 dr-xr-xr-x     0      0         0  3-Apr-2023 17:45 .
       5 dr-xr-xr-x     0      0         0  3-Apr-2023 17:45 ..
    4335 dr-xr-xr-x     0      0         0  7-Mar-2016 07:57 $RECYCLE.BIN
  530569 dr-xr-xr-x     0      0         0 29-Mar-2016 16:25 Folder1
  531255 dr-xr-xr-x     0      0         0 26-Feb-2016 16:00 Folder2
  524569 dr-xr-xr-x     0      0         0 26-Feb-2016 15:54 Folder3
 1064063 -r--r--r--     0      0      3538  4-Mar-2016 23:54 list.txt

interface_write()
 1 * HPFS - NTFS              0  32 33 243201  78 13 3907026944
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
::: several similar lines :::
ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 1024   usa_ofs: 0  usa_count: 65535: Invalid argument
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_attr_find: Corrupt inode (-1): Input/output error
ntfs_mst_post_read_fixup_warn: magic: 0x93d9b08c  size: 1024   usa_ofs: 59825  usa_count: 16722: Invalid argument
Using locale 'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=it_IT.UTF-8;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=it_IT.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=it_IT.UTF-8;LC_ADDRESS=it_IT.UTF-8;LC_TELEPHONE=it_IT.UTF-8;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=it_IT.UTF-8'.`

这里总结了我到目前为止所遵循的步骤https://archive.is/j66F9 非常感谢用户多德格因为在最初的问题中对我非常耐心。

答案1

重做 ddrescue 尝试,让它完全完成并希望 testdisk 重新创建文件系统

如果您仍然拥有生成的中间日志文件,ddrescue您可以重新启动恢复过程,并且它将尝试从中断处继续。但是,如果您已经以任何方式更改了目标映像,那么这将显着降低您继续的机会,并且您应该考虑重新启动(使用新的日志文件)到新映像。

请注意,ddrescue并不要求目标是设备 - 足够大的分区上的文件是完全可以接受的

相关内容