Open Source

Recover data the right way using Photorec

Data recovery is just a fact of life, but you can be ready for any disaster with a little planning and a lot of foresight.

Accidental file deletion and corruption is just a part of life. To err is human, so we need to be armed with the essential tools to combat our own foolhardiness with file management. Unfortunately, in the field of data recovery, this kind of operation is much more delicate than downloading file recovery software and allowing it to run its stuff. In fact, I consider so-called quick-and-easy file recovery apps for Microsoft Windows to be horrendously irresponsible for allowing users to attempt a scan on the system drive while booted into Windows.

Simply put, there are some important rules that must be followed in order to ensure high probability in recovery rates and high data consistency. I call these "The Three Golden Rules to Data Recovery," and they are as follows.

  • If you accidentally deleted a file, do not initiate any further file transactions to that disk. The more you make, the less likely you will be able to recover said file.
  • Never ever run file recovery software off the same drive you are attempting to recover from.
  • Always have a data recovery kit handy for when disaster strikes. This will consist of a boot disc that contains the necessary data recovery software.

Tool of choice

So now that you know the top three rules for proper data recovery, let's take a look at the best tool I have used to recover files off FAT/FAT32 and NTFS partitions: Photorec. This is an open-source tool designed to deep scan any Windows- or Linux-formatted volumes for deleted files and subsequently recover those files using carefully crafted heuristics. Since this is a Linux-based tool, we will need to create a Linux boot CD. Ultimate Boot CD, a freeware bootable systems utility disc, just so happens to contain Photorec along with its normal suite of tools.

Make the recovery toolkit

To get started, download the burnable ISO image for The Ultimate Boot CD at the main product website, and then burn to disc. As indicated by one of the golden rules I have listed, it is strongly recommended to download and burn on a system other than the one you are recovering files from. Once the disc is prepared, proceed to boot your PC off it and select HDD, Data Recovery and then Photorec accordingly from the boot menu options.

This will boot you into a Linux desktop environment with an array of icons to choose from. For Photorec, we will need to launch a terminal window by clicking the computer monitor icon located on the menu bar.

Within the confines of the terminal window, type in "photorec" and hit Enter. Now, simply select the drive you wish to recover files from, the partition table type (most likely "Intel" on a Windows PC), the partition itself, the file system the partition uses (usually the option labeled "Other"), and, lastly, the amount you want to scan — only the free space or the whole disk.

Before the scan proceeds, Photorec will ask where you wish to dump your recovered files after it is finished. It is recommended to pick an external disk drive like a flash drive or even a secondary partition. Once you press the [C] key to confirm the destination directory, the scan process commences. Feel free to get up and tackle something else, as Photorec's procedure will take quite awhile on most hard disks.

Photorec

Like any file recovery option, results aren't necessarily guaranteed and your mileage will vary. However, by taking the necessary precautions and extra care, your chances for full recovery increase. Using a boot CD for this process prevents unexpected disk writes while Windows is in operation on the main system drive. Photorec also seems to be more thorough with its scans than other apps like Recuva or even some commercial paid apps, at least in my experience.

Finally, even if you don't have any data that needs restored, it would be an excellent idea to download the ISO for The Ultimate Boot CD, burn it to disc, and then stash it in a safe place for future use. That way, when bad things happen, you'll be ready.

Also read:

About

An avid technology writer and an IT guru, Matthew is here to help bring the best in software, hardware and the web to the collective consciousness of TechRepublic's readership. In addition to writing for TechRepublic, Matthew currently works as a Cus...

Editor's Picks