Recovering Photos From a Bad Hard Drive

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.)

  1. Connect the bad drive to a computer running Ubuntu. (Any linux will do, but some of the details below assume Ubuntu/Debian.)
  2. apt-get install gddrescue testdisk (Note that "ddrescue" is not the same thing.) Gddrescue provides a "ddrescue" program, and testdisk provides "photorec".
  3. Look in dmesg to see where the new drive lives. Mine is at /dev/sdc
  4. Run sudo fdisk -l /dev/sdc and 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.
  5. 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.
  6. 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.
  7. Run photorec /d recovered_files hdimage and walk through the prompts. Recovered files will be dropped in a series of directories named recovered_files.NN, where NN is an incrementing number.
Posted on 2013-05-03 by brian in tools .
Comments on this post are closed. If you have something to share, please send me email.