What is Photorec?
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.
For This HowTo Recover Deleted Files?
Lets say I had a file download_arrow.png in /home/aryan/Desktop which I have removed accidentally. Login as root and create a directory recover which will be used to store all the recovered files.
Install testdisk/PhotoRec
Photorec comes as a part of testdisk package in Fedora (I hope its same for other distributions as well). Use yum to install testdisk.
[root@fedora-tips ~]$ yum install testdisk
Launch Photorec
Once you are done with installation. Open a terminal and launch photorec (as root).
[root@fedora-tips recover]$ photorec
Select Hard Disk
If you have more than one hard disk in your system, select the one from which you have deleted the file(s).
Select Partition Type
If your hard disk has Linux partitions, then select [Intel].
Select Filetype Option
Move to [File Opt] and press enter. Here you can disable all file types by pressing ’s’ . Use space to toggle the check button. Now since we removed a png file, we are going to check only png file type.
Select Options
Photorec also has a list of different options. Under normal circumstances you don’t need to modify them
Select Partition
Move the selector to the partition from which you have removed the file. Then press enter on search.
Select Filesystem Type
If you are using Linux, its going to be ext2/ext3/ext4. So the default selection is file.
Select Space for Analysis
Select free if you didn’t write to that partition after removing the particular file otherwise select whole.
Select a Directory to Recover Files
Now select the path where the recovered files will be stored. Then press ‘Y’.
Recovery Progress
Photorec will show how many files it has recovered.
All recovered file will be stored in the directory selected above. Open them in a file browser and you’ll get the removed file there. I hope this howto will help you recovering files you accidentally delete