Photorec recovery deleted files on RHEL/CentOS/Fedora and Ubuntu/Mint linux

PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media’s file system has been severely damaged or reformatted.
PhotoRec is free – this open source multi-platform application is distributed under GNU General Public License (GPLV v2+). PhotoRec is a companion program to TestDisk, an application for recovering lost partitions on a wide variety of file systems and making non-bootable disks bootable again.
PhotoRec runs under

  • DOS/Win9x
  • Windows NT 4/2000/XP/2003/Vista
  • Linux
  • FreeBSD, NetBSD, OpenBSD
  • Sun Solaris
  • Mac OS X

and can be compiled on almost every Unix system.

Install PhotoRec

Install PhotoRec on RHEL/CentOS and Fedora linux

To install Photorec on RHEL/CentOS and Fedora simply type:

# yum install testdisk -y

For Ubuntu/Mint Linux:

# sudo apt-get install testdisk -y

How to use PhotoRec

After sucessfull installation go to terminall and type following command (You need to run photorec with root privileges):

# sudo photorec

Choose the HDD which contains partition from which you want to recover lost files and hit <Enter>.

PhotoRec select your Disk(HDD,USB...)
PhotoRec select your Disk(HDD,USB…)

On the next screen, you’ll need to choose your source partition from which the files will be recovered. Choose your partition and hit <Enter>.

Photorec, Choose Partition
Photorec, Choose Partition
Select File options
Select File options

Choose type of deleted file extension, in my case is a photo with extension .jpg and then type enter:

Choose type of deleted file extension
Choose type of deleted file extension

Here you need to choose your source partition’s filesystem. For a Linux system it is ext2/ext3 in most cases which is auto detected by photorec. Just hit.

Photorec, Filesystem Selection
Photorec, Filesystem Selection

Now you’ll get an option to whether scan only the Free sectors on that partition or the Whole partition including those sectors which currently have data on them. Choose Free at first. If you can’t find files you were looking for, start over and choose Whole. Scanning the Whole partition will take a lot more time than scanning the Free sectors.

Photorec Options
Photorec Options

Select Destination to recovered files and pres “C” key.

Select destination to save recovered files
Select destination to save recovered files

Now photorec start to recover, the operation will take some time so be patient.

Photorec Start to recover
Photorec Start to recover

See also: Recover deleted files and folders using scalpel (A Filesystem Recovery Tool) on linux

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button