PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from Hard Disks and CDRom and lost pictures (thus, its ‘Photo Recovery’ name) from digital camera memory. PhotoRec ignores the filesystem and goes after the underlying data, so it will still work even if your media’s filesystem has been severely damaged or re-formatted.
PhotoRec work’s on
Windows NT 4/2000/XP/2003/Vista
FreeBSD, NetBSD, OpenBSD
Mac OS X
and can be compiled on almost every Unix system.
Installing Photorec on Ubuntu:
#sudo apt-get install testdisk
For any other distributions download it from source code
#tar xjf testdisk-6.14.linux26-x86_64.tar.bz2
Recover deleted file using Photorec :
For example, Let`s assume that i deleted accidently a photo from a partition with filesystem NTFS ,to recover the deleted photo i will have to follow the steps bellow as described on the screenshots.
First, open the terminal and type :
Choose your hard disk
Choose the partition from where you deleted the file, you can set File Opt to choose the file extension you want to recover
choose type of deleted file extension, in my case is a photo with extension .jpg and then type enter (you can select extension by using space in your keyboard)
Now choose the type of the filesystem, in my case is a EXT4 (shared partition) so i will choose Other.
You will got a message if you want to save the recovred file on system , in my case is /MINI yes and then enter
Now you have to select [free] if you diden`t write the the partition after deleting the file, otherwise choose [whole ]
Now photorec start to recover, the operation will take some time so be patient.
When the program will finish recovering, go and check the folder where the file will be recovred, your document or photo will be there🙂.
For more safety, PhotoRec uses read-only access to handle the drive or memory support you are about to recover lost data from. Important: As soon as a pic or file is accidentally deleted, or you discover any missing, do NOT save any more pics or files to that memory device or hard disk drive; otherwise you may overwrite your lost data. This means that even using PhotoRec, you must not choose to write the recovered files to the same partition they were stored on.