How to use PhotoRec on Linux


Table of Contents

Today, data recovery is in its very advanced stages and you can effectively recover lost files from virtually any storage device. If you use Ubuntu, then PhotoRec will come in handy to recover data.

PhotoRec data recovery software is a tool built by CGSecurity – the developers of TestDisk. It is free to use and is particularly built for digital media recovery. You can therefore use this software to recover photos, and videos among other digital media. Besides, it can be installed and used on a wide range of platforms such as Linux and Windows.

To be reading this guide now, you must be facing some challenges with PhotoRec on Linux. If you didn’t know, it is among the leading data recovery software (some of which work on Linux). Similar to other data recovery software like Disk Drill by CleverFiles, PhotoRec analyzes data sectors on the drive to determine its extent. The tool then searches the disk to recover files on Linux/Ubuntu and returns all detected files saved in a folder. 

How to Install PhotoRec in Linux Ubuntu

Like we said, this is an open-source software that you can use as much as you want for free. 

Step 1: Begin by running the command “sudo apt update” to update the package index on your device. 

Step 2: Now install TestDisk executive from the repository using the command “sudo apt install testdisk.”  

If by any case it is not in your Linux distribution’s repositories, download it first, and manually install it from a Live CD. 

Remember that you can also find it in rescue CDs such as Ubuntu Boot CD and Rescue-Remix etc. for quick and easy installation.

You will however need to provide permission to run PhotoRec as an administrator. 

Step 3: Press “y” then enter to accept.

When you type “Sudo PhotoRec,” and get a greeting page with details about the available media, use the up/down arrow keys to navigate to your selection then select “Proceed,” before hitting Enter. 

Once the software is installed, you can use it in the next section to recover lost files. 

How to Use PhotoRec on Linux

In this section, we will show you how to recover deleted files with PhotoRec following a step-by-step process. 

Step 1: Launch the software

Now that you have installed PhotoRec in your device, click on it to launch and begin the recovery process. You can also do this with the command “sudo photorec /dev/sda3.” 

Step 2: Select Storage Disk

Once the software is running on your device correctly, check the listed storage media. PhotoRec provides a list of available storage media to make it easy to initiate data recovery on Linux computers. You can scroll with the up/down arrows to highlight and select the disk containing the lost files. Press Enter to complete the selection. 

Step 3: Select source Partition

PhotoRec asks you in the next screen to choose the partition where your files were lost from. With the up/down keys, navigate to choose the partition then hit the “search” button to begin the recovery process. You can also do this with the Left/Right arrow keys so as to go through the “Options” for changing the options as in step 4, and “File opt” to list the file types recovered as in step 5. 

Step 4: PhotoRec Options

Choose the appropriate option. PhotoRec has up to five different options that you need to be aware of to make your user experience better. 

Step 5: Select File System Type

Now go to “File Opt” to be able to enable or disable recovery of the specific files. 

Choosing a file system is very easy with PhotoRec. This is because the software understands the data block distribution once a partition has been identified and confirmed through “search.” However, if you are not using Linux ext2/ext3/ext4 file systems then you can choose “other.”

Step 6: Carve the Partition or Unallocated Space Only

PhotoRec can search for files in multiple locations including the entire partition or specific partitions depending on your choice. Select the option you need only to improve your search experience. 

Step 7: Select a location to write recovered files

At this stage, you are closer to recovering the files and you need to choose an appropriate location to send them. You can use the arrow keys to quickly access the drive list. Once you are there, press Enter to complete the selection. You can then verify the selection with a “Yes” when prompted.

Data recovery on Linux is as easy as we have described. Remember, you can also undo file deletion on Linux systems without requiring to use any third-party application. However, where PhotoRec is involved, the process is even more seamless.

How Long does Linux recovery Take

Once you have completed step 7 and recovery started, it should only take a few minutes to get your files. The time taken however depends on the number of files in your selection. The software however keeps you updated on the number of file types recovered and you can easily access them even before the whole process ends. 

Advantages of PhotoRec Recovery

At the end of the recovery, PhotoRec displays a summary of all the recovered files. However, if something happened in between or you interfered with the recovery process, PhotoRec keeps it in memory and reminds you with a prompt to resume from where you stopped the next time you launch it. 

Disadvantages of PhotoRec Recovery

PhotoRec cannot search for a specific file only. You will need to identify the specific files you are looking for by sorting the search results in the folder manually. It is important to note that Disk Drill makes it much easier to preview and recover individual files, something PhotoRec has not been able to achieve in the many years.