Recovering data from a failing HD

ハードディスク修復方法。Xubuntu 11.10の環境で行いました。説明は英語ですが、使ったコマンドは「lshw」, 「ddrescue」, 「dd」, 「mount」, 「resize2fs」, と「e2fsck」です。手順は一番下にあります。修復作業は1日でできますが、久しぶりにやっとので二日以上かかった!

I was using Xubuntu 11.10 when I was trying this.


To get a list of the devices on th PC run fdisk,  sudo fdisk -l.

If you are lucky then it will detect the disk. In my case, the OS didn't detect it.

So I tried sudo lshw -C disk -short and cat /proc/partitions to get the name of the device.

Then, I used ddrescue (package name is gddrescue) to image the file. I did this by first running ddrescue --no-split /dev/sdd1 / media/gamma/image /media/gamma/image.logfile, then by trying ddrescue -r 3 /dev/sdd1 /media/gamma/image /media/gamma/image.logfile to try to squeeze every bit of data out of the drive.

Next, I used dd to make another image as backup, so I can try to repair the original. I do this by dd if=/media/gamma/image of=/media/gamma/image_backup. This took a while. Next I tried to mount the image to recovered mount -o ro image recovered as a read-only file, but that failed. The block sizes that were being reported were different. So I fixed that by resize2fs image SIZE, where SIZE is the target size. This time it mounted. Next, I used e2fsck -vyp recovered, recovered is the folder to mount the partition to, to repair the filesystem.

After which I can now look at all my files that I recovered and use rsync to move them all to a safer place!

It took more than two days, but I figured it out and got 90% of my data back!



To summarize:

sudo lshw -C disk -short
ddrescue --no-split /dev/sdd1 /media/gamma/image /media/gamma/image.logfile
ddrescue -r 3 /dev/sdd1 /media/gamma/image /media/gamma/image.logfile
dd if=/media/gamma/image of=/media/gamma/image_backup
mkdir /media/gamma/recovered
mount -o ro /media/gamma/image /media/gamma/recovered
# In my case, I had to resize the image to size SIZE. 
resize2fs /media/gamma/image SIZE 
mount -o ro /media/gamma/image /media/gamma/recovered 
e2fsck -vyp recovered

コメント

このブログの人気の投稿

RStudioとggplot():プロットができないとき

とても忙しい一週間

新年度は新上五島町へ