I've had a couple of friends ask me if there's any way I could read family photos off a dying hard drive. Obviously, the best way to do this is to have a backup: then you can throw out the hard drive (use an electronics recycler) and restore your backup to a new drive.
But if you've arrived at this page, you probably don't have a backup...
I'm writing this down mainly because I forgot the details after I did this the first time, and I don't want to have to do the research again.
This will only work if the drive is still alive enough to be mostly readable. If it is well and truly dead, I can't help you. Even if it's only half-dead, I still can't help you -- this is what worked for me, there are probably better ways to accomplish this, I'm not an expert in this area. (In other words: don't ask me for help.)
- Connect the bad drive to a computer running Ubuntu. (Any linux will do, but some of the details below assume Ubuntu/Debian.)
apt-get install gddrescue testdisk(Note that "ddrescue" is not the same thing.) Gddrescue provides a "ddrescue" program, and testdisk provides "photorec".
- Look in dmesg to see where the new drive lives. Mine is at
sudo fdisk -l /dev/sdcand verify that the size and type are what you expect. In my case, the drive to be rescued is from a Windows box and formatted NTFS, so I know that I'm not mixing it up with any of the ext3 drives that are on my system.
- Create a directory to hold the rescue image, logfile, and
files that will be extracted from the image. I put mine in
~/HDD_Rescues/Friend1/. Obviously, the destination directory needs to be big enough to hold the contents of the drive to be rescued.
- cd to that directory and run
ddrescue /dev/sdc hdimage logfile. This will try to read from the entire disk, saving the result in
hdimage, and keeping track of what has been done in
logfile. The advantage of the logfile is that, if an error occurs or you need to interrupt the recovery, it can continue where it left off. One drive I recovered was broken enough that it would die after a few 10s of MB -- and needed a reboot to recover. So the pattern is: run ddrescue, wait for error to occur, reboot, repeat until enough data has been recovered.
photorec /d recovered_files hdimageand walk through the prompts. Recovered files will be dropped in a series of directories named
recovered_files.NN, where NN is an incrementing number.