Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Friday, December 17, 2010

Browse » Home » , , , , » How to recover deleted files?

How to recover deleted files?

Frequently I get messages like “I have accidentally deleted myproject. Is there any way to recover it in Linux?” or “I worked reallyhard on that program and managed to deleted it right before submission :( How do I recover?”. Well I didn’t really have any idea on “How to actually recover deleted files in Linux”.

A few days back I was designing the new logo for my sitein Inkscape. After finishing the design, I saved the svg filecarefully. And deleted other images which I embedded in the logo. A fewmoments later I realized that I just screwed up myself by deleting allthose files as the svg file is now good for nothing.

I searched a lot on recovering files in Linux but in vain. Then a friend told me about Photorec. I managed to recover all the files usingphotorec. I thought it would be a good idea to let others know andspread a good word about Photorec. Below is a step by step howto onusing Photorec to recover your files.

What is Photorec?

From Photorec website,
PhotoRec(Download for Windows | Download for Linux RPM) is file data recovery software designed to recover lost files includingvideo, documents and archives from Hard Disks and CDRom and lostpictures (thus, its ‘Photo Recovery’ name) from digital camera memory.PhotoRec ignores the filesystem and goes after the underlying data, soit will still work even if your media’s filesystem has been severelydamaged or re-formatted.

For This HowTo

Lets say I had a file download_arrow.png in /home/saini/Desktopwhich I have removed accidentally. Login as root and create a directoryrecover 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 itssame 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).
PhotoRec Hard Disk Selection

Select Partition Type

If your hard disk has Linux partitions, then select [Intel].
PhotoRec Partition Selection

Select Filetype Option

Move to [File Opt] and press enter. Here you can disable all filetypes by pressing ’s’ . Use space to toggle the check button. Now sincewe removed a png file, we are going to check only png file type.
PhotoRec Filetype Selection

Select Options

Photorec also has a list of different options. Under normal circumstances you don’t need to modify them
PhotoRec Option Selection

Select Partition

Move the selector to the partition from which you have removed the file. Then press enter on search.
PhotoRec Partition Selection

Select Filesystem Type

If you are using Linux, its going to be ext2/ext3/ext4. So the default selection is file.
PhotoRec Partition Selection

Select Space for Analysis

Select free if you didn’t write to that partition after removing the particular file otherwise select whole.
PhotoRec Space Selection

Select a Directory to Recover Files

Now select the path where the recovered files will be stored. Then press ‘Y’.
PhotoRec Recovery Directory Selection

Recovery Progress

Photorec will show how many files it has recovered.
PhotoRec Recovery Progress
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. Ihope this howto will help you recovering files you accidentally delete

You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.


Post a Comment

Back to Top