如何从损坏的驱动器浏览图像(恢复丢失的数据)

如何从损坏的驱动器浏览图像(恢复丢失的数据)

目前我相信我遇到了驱动器(HDD)故障。它是一个用于额外存储的单分区驱动器。当我尝试安装它时,出现以下错误:

# mount /dev/sdc1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

按照建议检查 dmesg:

# dmesg | tail
[12641.405658] blk_update_request: critical medium error, dev sdc, sector 2064
[12641.410139] Buffer I/O error on dev sdc1, logical block 2, async page read
[12641.415774] EXT4-fs (sdc1): couldn't mount as ext3 due to feature incompatibilities
[12641.420578] EXT4-fs (sdc1): couldn't mount as ext2 due to feature incompatibilities
[12644.186523] sd 5:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12644.186543] sd 5:0:0:0: [sdc] tag#0 Sense Key : Medium Error [current] 
[12644.186556] sd 5:0:0:0: [sdc] tag#0 Add. Sense: Unrecovered read error
[12644.186570] sd 5:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 00 08 10 00 00 08 00
[12644.186580] blk_update_request: critical medium error, dev sdc, sector 2064
[12644.191255] EXT4-fs (sdc1): can't read group descriptor 1

正如我所说,我假设开车是在晚上,所以我想至少保存我在那里的所有信息(顺便说一句,这更重要)。我尝试从驱动器上砍掉 500GB,只是为了看看它是否有效:

# ddrescue -d -s 500G /dev/sdc data.img data.log

不幸的是,我通过 ssh 运行它,我的管道坏了或者其他什么东西,所以我最终得到了一个大约 150GB 的img文件,当我尝试安装该文件时,我得到了与尝试安装驱动器本身时遇到的相同错误(废话):

# mount data.img /mnt -o loop
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

我怎样才能获取应该保存的信息?

答案1

对于发现此问题的任何人,我设法解决了该问题,而无需诉诸photorec其他工具。我制作了一个完整的磁盘映像,以防万一,使用ddrescue但最终不需要它。

运行badblocks并查看 SMART 数据,我确定驱动器开头的某个位置有 1 个损坏的扇区。显然这是存储超级块的地方,这就是分区无法识别且无法安装的原因。

我尝试跑步e2fsck -cfpv /dev/sdc1并得到了

e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdc1
Could this be a zero-length partition?

我是个菜鸟,我不知道发生了什么,但显然用零覆盖该扇区并重新运行e2fsck会产生某种魔力并修复分区,之后我能够安装分区并复制之前的所有文件把硬盘扔出窗外。以下是我发出的命令(是的,e2fsck当我注意到分区被识别并可以安装时,我立即停止了):

# dd if=/dev/zero of=/dev/sdc1 bs=4096 count=1 seek=0
1+0 records in
1+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.000367146 s, 11.2 MB/s

# e2fsck -fy -b 32768 /dev/sdc1
e2fsck 1.46.2 (28-Feb-2021)
Superblock needs_recovery flag is clear, but journal has data.
Recovery flag not set in backup superblock, so running journal anyway.
/dev/sdc1: recovering journal
Pass 1: Checking inodes, blocks, and sizes
^C/dev/sdc1: e2fsck canceled.

/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****

完整的解释和所有的功劳归于这家伙我祝愿宇宙赐予他大量的健康和财富,并满足他最深的愿望!

相关内容