Recovering bad discs in Linux – pt 2
So, maybe in part 1 the data recovery didn’t work for you?
Well, that’s OK because Linux is robust against bad discs in one form or another. The trick is to work out what that might be.
A good method is to use dd or dd_rescue. These tools create a forensic copy of your hard disk drive or partition so that you can mess around with it without affecting the original drive. This is also a benefit as generally a virtual disk will mount and work faster than a faulty disk drive.
To begin with, we need to create that copy of the partition that you need data from.
dd_rescue /dev/hda1 ~/myDisks/hda1.image
The reason that I’m using dd_rescue rather than dd is that seeing as you’re reading this guide, the drive probably has faulty areas of the disk. dd_rescue will work around those quite nicely.
I’m working on the premise that it’s a single partition that you need to recover. If not, you may want to look over at http://edseek.com/~jasonb/articles/linux_loopback.html#id2494145 to read up on ways to read parts of disk images and generally show off.
Right, so we have our image.
Let’s set up the mount point
And now mount the new partition image
mount -o loop ~/MyDisks/hda1.image /mnt/restore
The partition should now mount on the folder. To check if anything is there:
You should see a familiar list of files (or if someone else’s drive, one that is not so familiar). You can now copy the files away and do whatever you need to do to the image.
Once finished, unmount the disk image