Skip to content

How to Start Recovery from a Specific Sector with PhotoRec

TestDisk is a powerful data recovery software that is primarily used for recovering lost partitions. The software comes bundled with another utility called Photorec which is geared towards the more common task of recovering deleted / lost files.

Photorec is similar to other free popular file data recovery programs like Recuva though unlike them works on the command line. A GUI version qphotorec is however provided with TestDisk though it provides less customization options compared to Photorec.

Unfortunately, Photorec only provides a detailed scan which can last several hours on large disks / partitions. This is unlike other data recovery programs which offer a quick scan mode which is always worth a try before using the detailed (deep) scan modes. The upside of this detailed scan, however, is that Photorec tends to fare better at recovering lost files (albeit at times with a lot of duplicates or existing files).

When you run Photorec, one gets the option to recover data from either the whole disk or specific partitions. In both cases, one can either scan the unallocated space (free space) or the whole partition / disk for files to recover. To save time, you may consider starting either of these scans at specific sectors on the disk / partition. Here’s how to go about it:

Steps

1. Run Photorec and select the disk or partition to recover the files from.

2. Select whether to analyse the free space or the entire disk / partition.

3. Select the folder where to save the recovered files. Ensure you select a different partition or disk from the one you’re trying to recover data from. The scan will begin immediately after selecting the target folder.

4. Select the Stop option to interrupt the scanning, then exit the program.

5. Go to the TestDisk installation folder, and find a new file called photorec.ses. Open this file using a plain text editor like notepad, vim etc.

6. Edit the last number in the long line containing the recovery parameters with the specific sector you want to begin at. The following is an example of the file with the number to edit highlighted:

#1685961803
/dev/sdb partition_i386,255,blocksize,512,fileopt,everything,disable,mov,enable,options,paranoid,keep_corrupted_file_no,wholespace,search,status=ext2_off,200928,inter
0-753979
753980-1574106
1574107-1578302
1578303-1610742
1610743-1771487
1771488-1771491
1771492-1999159
1999160-625142447

7. Save the file and run Photorec.

8. Press Y when prompted whether to resume the previous session.

9. Select the folder to save the recovered files then press C to begin the scan again. This time round the scan will begin from the sector specified in the photorec.ses file.

TIP: Consider using the File Opt option if you only need to recover a specific file format (e.g ZIP, JPG). This will narrow down the amount of files recovered thereby saving you space. This option becomes available right after selecting the target disk / partition for recovery.

Share:

Leave a Reply

Feel free to share your comments or questions with me. I may not be able to respond immediately so please check later once I've approved your comment.

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

Kelvin Kathia

Kelvin Kathia is a writer that's passionate about sharing solutions to everyday tech problems. He's the founder and editor of Journey Bytes, a tech blog and web design agency. Feel free to leave him comments or questions regarding this post, or by leaving him a message on the contact page. If you found his content helpful, a donation is much appreciated.