Visit Jeremy's Blog.
Go Back > Blogs > beachboy2
User Name


Rate this Entry

Data recovery using PhotoRec and QPhotoRec

Posted 04-04-2018 at 06:28 AM by beachboy2
Updated 04-04-2018 at 01:12 PM by beachboy2

Warning: The dd command (aka the disk destroyer) can seriously harm your computer if used incorrectly!
Be very careful when typing and selecting drives or partitions!

Despite its name, PhotoRec recovers virtually every file format imaginable, not just photographic formats such as jpg, png or tiff. Recoverable formats include:

Install TestDisk (includes PhotoRec) and GNU ddrescue (by Antonio Diaz):

 sudo apt-get install testdisk

 sudo apt-get install gddrescue
Plug in a USB external hard drive (EHDD) which is at least the same size as the source drive and in Terminal run:

to identify all the disks and partitions, including the EHDD (say, sdb).

It is safer to clone the source drive (sda) first using:

sudo ddrescue -v /dev/sda /dev/sdb
and then later operate on the destination drive sdb (EHDD) using PhotoRec (or TestDisk).

Should TestDisk or PhotoRec fail to recover data from the EHDD (sdb), it is then possible to send the original drive (sda) to a specialist data recovery company.

Personally I have found that using QPhotoRec, the graphical user interface (GUI), version of PhotoRec on a Windows computer much simpler to use (yes, I realise that this is heresy on a Linux forum).

Those wishing to use Linux, please see Using PhotoRec in Linux below.

For those with access to a Windows computer and a preference for a graphical user interface, download qphotorec via from:

First create a new folder inside (Windows) Documents called PHOREC or similar.
Then unzip the above files, open the resulting folder and select the qphotorec_win application. Double click on it to open.

On the Windows computer plug in the EHDD containing the clone of the original drive.

NOTE: The recovered files are to be saved to either PHOREC in Windows Documents (OR phorec2 on a different EHDD).

To recover photos or other supported file types

1.Select the correct disk from the menu at the top. Note that drive letters are not shown by the program. Either use the size of the disk as an indicator or its label (PhysicalDrive0 is the first internal drive for instance).

2. Select one of the available partitions from the list or pick whole disk if you want all of the disk scanned regardless of partition (and thus drive letters).

3. Make sure the file system is correct. On Windows, this is usually FAT or NTFS. On Linux it will be ext4 or similar.

4. Select whether you want to scan unallocated space only (that is free space), or the whole disk or partition.

5. Using the Browse button, select the destination folder, which is either C:\Documents\PHOREC on the Windows computer, OR (say “F”) for a different EHDD for the recovered files. Make sure that the destination folder is not located on the same disk that is being processed by PhotoRec.

6. Click on File Formats and click on Reset. Then select only the required file formats (e.g. for photos only, just select jpg and PNG types etc). Leaving all file formats selected will mean waiting for much longer as the more exhaustive search is carried out.

7. When satisfied that all required file formats have been selected, hit the Search button and wait until the process completes.

Using PhotoRec in Linux:

The PhotoRec user guide for Linux:

Please see the following links to avoid the error, "Warning: not enough free space available" after recovering a few hundred files.

Sorting PhotoRec recovered files:


TestDisk 7.0 release:

Testdisk manual:

GNU ddrescue manual:

How to recover lost or inaccessible data from any storage device:
Posted in Uncategorized
Views 6253 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 06:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration