Recovering Files on Linux
April 13, 2008
I recently lost a lot of digital pictures by accidentally deleting them. Upon doing some research and a little bit of experimenting I recovered every picture I lost, and actually more…
First off if you need to recover pictures or any other file you have accidentally deleted you may want to read my first post to understand how you can get them back, and so you understand why you shouldn’t do anything that that would write anything more to your hard drive or flash drive you want to recover files from.
The first step in recovering your lost files is going to be have your media plugged in if its a flash drive, or external hard drive. If its your main hard drive then you obviously don’t need to plug anything else in.
Next you are going to want to install testdisk, this can be installed through a terminal with:
sudo apt-get install testdisk
This will allow you to use the terminal command photorec, but you will want to run it with root privileges so:
sudo photorec
This will bring up something like this:

in this first menu you want to select the drive you want to recover files from. The first one I have highlighted is 80 gigabytes, and is my computers hard drive. The second one is the option I will choose because I want to recover files from my camera flash memory stick. So I will highlight that option using my keyboards arrow keys and hit enter.
The next screen you will see is this:

On this screen you will need to select the partition type of the drive you are recovery files from. Pick it using the arrow keys again then press enter when its selected.
On the next screen you will pick which partition you want to recover files from on your drive, for my case I am using a flash card from my camera so it only has one partition:

The next screen you will need to choose the file system type that the files are on that you are trying to recover:

The next part is where you pick the destination of the recovered files to go after they are recovered. As you can see below I created an “output” directory earlier in my home directory to store all my recovered files. This is where I choose to have my recovered files placed:

That will then bring me into the output directory folder and I can type “y” to pick that as my output for recovered files. If you just want them in your home directory then you can just type “y” on the last page:

Now finally the file recovery will begin:

This read out tells you how many of each type of files were recovered and where they were saved. I stopped mine after a few seconds because I already recovered all my photos but it will keep going until it scans your whole device! This is a great tool, and a memory savor for those who accidentally delete important pictures!
Entry Filed under: Uncategorized. Tags: file recovery, photorec, photos, testdisk.
1 Comment Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1. htop to the rescue «&hellip | April 18, 2008 at 7:35 pm
[...] why it is still running…If you don’t know about photorec, I did a nice review of it here on how it helped me recover deleted [...]