Photorec saves the day again

Every now and then my friends seem to accidentally have their files deleted. You can read here about last year’s incident. This year, another friend, who keeps her photos on one laptop with no backups had some folders mysteriously go empty. I had no idea how they got deleted, but I assured her we could probably get most of them back. I didn’t realize what it would take, though!

First of all, I had to borrow an external hard drive, since mine didn’t have enough free space to copy over her entire drive. I booted up a Ubuntu live CD and installed testdisk and tried to run

sudo photorec

on the drive. It appeared to work until it got to 1464 files. Then it just froze up. So I stopped it and restarted it. Froze on 1464 again. Clearly something was wrong. So I tried scanning only the unallocated space on the drive and Photorec gave me a segmentation fault error. I knew the drive was probably damaged in some way.

I figured imaging the drive with ddrescue would solve the problem. I ran it overnight and the next day I realized the external hard drive I’d borrowed was formatted as FAT32 and so would not hold a disk image larger than 4 GB. I resized the partition and created a new NTFS partition and ran ddrescue again. There were a lot of bad blocks on that drive in various places. Running front to back and then running back to front, ddrescue took almost 40 hours to image that 80 GB hard drive with bad blocks.

Then it took another four hours for Photorec to scan the imaged drive and recover the photos. I don’t think it ended up getting everything, but it got a lot, and my friend was grateful and felt a little guilty that I’d spent so much time recovering her data. Instead of accepting a thank-you from her, I told her, “Just buy an external hard drive and back up your photos.”

I think it’s human nature to have to learn the hard way. Most people don’t start backing up until they’ve lost important files.


  1. Hi,
    I have just followed ur method and have had ddrescue create an image on a good external hard drive, but i still get segmentation faults when running photorec after recovering 10% of the files.

    Any ideas?


Leave a comment

Your email address will not be published. Required fields are marked *