Jump to content

Build Theme!
  • Infected?


Hey there! :wub: Looks like you're enjoying the discussion, but you're not signed up for an account. When you create an account, we remember exactly what you've read, so you always come right back where you left off. You also get notifications, here and via email, whenever new posts are made. You can like posts to share the love. :D Join 92790 other members! Anybody can ask, anybody can answer. Consistently helpful members may be invited to become staff. Here's how it works. Virus cleanup? Start here -> Malware Removal Forum.

Try What the Tech -- It's free!


Using Photorec and Puppy Linux to find lost/deleted files

  • Please log in to reply
5 replies to this topic

#1 terry1966



  • Visiting Tech
  • PipPipPipPipPip
  • 2,988 posts

Posted 18 October 2011 - 06:15 PM

Have you ever formatted/deleted a partition/drive then realized you had important files on it?
Then this guide may help you to recover them.

To follow this guide Puppy needs to find and configure your internet connection automatically.
If for any reason you have a problem using this guide then I suggest you start a topic here: http://forums.whatth...p?showforum=121
The Tech's will try and help you solve any issues or maybe even suggest other ways to get/ install/ run, photorec.

First download and burn the latest version of Puppy Linux to a bootable medium, such as a CD or flash memory stick/drive then restart your machine using the medium as the first boot option to start Puppy Linux running.
This guide, by Ztruker, explains how to create a bootable CD. http://forums.whatth...howtopic=111833

Starting Puppy
When Puppy starts up you'll see this screen.
Posted Image
Do nothing and it will boot to a Puppy Desktop in a few seconds.

The first thing you'll see is a welcome notice followed by this personalize settings box.
Posted Image
Change your time, language, keyboard settings to your region by clicking the down arrows and choosing from each drop down menu.

Setting up a web browser
Now before you can download and run photorec, you'll need to setup a web browser.
Click on the browse icon on the desktop, this will open a browser installer menu.
Posted Image
Just click on your browser of choice (I use Firefox) this gives me a choice of 2 versions, click on the newest one to start the download process.
When it's finished downloading, you'll get a confirmation box open up, just click the OK button to install.
When it's installed you'll get a success box open up, again just click OK button.
Now it'll install and update everything.
Click on the browse icon button again, this time it will start the Firefox web browser.

Getting photorec
Goto this site http://www.cgsecurit...stDisk_Download and click on the latest linux version to start the download.
A box will open up.
Posted Image
You want to save the file so click on the save file option, then click the OK button.
This box will open.
Posted Image
You're not going to change any of the defaults, and as you can see the file is going to be saved into the root folder, just click the Save button. When it's finished downloading the file, close the Firefox web browser.

Installing photorec
Click on the file icon on desktop to open the file manager.
Click the green up arrow to change the parent directory, now you'll see the root folder where we saved photorec, click on it to enter.
Posted Image
You'll see the saved file testdisk-6.12.linuxx26.tar.bz2 (yours may be a different version) click on it, this will open a new window.
Posted Image
Click the green tick to select all, then click the Extract button. A new box will open asking where to extract the files. You're not going to change it from the root folder so just click on the OK button.
When done extracting another box will open saying so, just click OK.
Now you should see a new folder in the file manager window called testdisk-6.12 (depends on version you downloaded).
Close both the open windows to finish.

Mounting all your partitions
Now before you go any farther we need to mount all drives/partitions (or at least the one you want to save any files to), you should see them on the desktop near the bottom left.
Click each in turn.
You should now have a green dot on the bottom corner of the drive icon to show it's mounted.
It'll also open a file manager window where you can see what if anything is on each drives partition.
Posted Image

I can't stress this enough, you need to KNOW(not think you know) the layout of your hard drives and any partitions otherwise you run the risk of overwriting the lost files you're trying to find (you'll have no chance of finding them then).

Here's a quick explanation: Linux sees hard drives in the order they are connected to the motherboard as shown in your PC's BIOS and not in the order they may appear in your Windows operating system, don't assume the c drive in windows is the first partition on your first hard drive, it may well not be.

Linux names hard drives sda, sdb, sdc etc. (used to be hda, hdb, hdc etc.) for the 1st, 2nd, 3rd, etc. hard drive as seen in BIOS.
Primary partitions on those drives are shown as numbers 1,2,3,4. if your hard drives have extended logical partitions then those numbers will start at 5 (so for an XP system with an OS partition and a 2nd data partition on it's first drive you'd probably see "sda1" and "sda5" where the "sda5" is the 2nd partition, there are not 5 partitions on the drive and for some reason 2,3,4 don't show.)

You can see from above picture, I have 2 hard drives, each with a single partition, sda1 and sdb1, both are mounted shown by the green dot.
sda1 is the drive/partition the lost files are on and sdb1 is the drive/partition where I'm going to save any found files.

Starting photorec
Click on the console icon on the desktop to open a console, now type in
cd ~/testdisk-6-12
Notice testdisk-6-12 is the name of the folder that was created in the root folder when I extracted photorec yours may be different depending on the version of testdisk you downloaded, so type in the correct folder name in place of testdisk-6-12.
Hit the enter/return key.
Now type in
Soon as you hit the enter key photorec will start running.
Before hitting the enter/return key, the console should look like this.
Posted Image
After hitting the enter/return key, it will look like this with photorec running.
Posted Image

Using photorec
The start screen as seen in above picture, shows all detected drives in your machine. In this test system you can see I have 2 hard drives, /dev/sda 10GB and /dev/sdb 6GB along with a cd drive /dev/sr0.

Now in this guide I'm going to search my first hard drive /dev/sda for some music files and save them to the 2nd hard drive /dev/sdb.

NOTE: You must have enough empty storage space on the drive/partition you're going to save the files on.
I recommend having a drive/partition with at least the same amount of free space on as the total size of the drive/partition you're searching.
If you know how much space your files used up, you can get away with using a drive/partition with at least 15% more free space than that amount.

Highlight the hard drive you want to search, using the up down arrow keys on the keyboard.
Posted Image
/dev/sda and proceed are both highlighted, so I hit the enter/return key to carry on to the next screen.

Posted Image
On this screen you have to specify the partition table type. For most people (all windows users regardless of operating system) this is going to be the first already highlighted "Intel" choice. Just hit the enter/return key to go to next screen.

Posted Image
Now here you can see the hard drive I'm searching listed along with the partitions on it (there is only 1 partition on this test system, yours may have more partition choices).

I'm going to search all the hard drive so, I use the up arrow key to highlight the "no partition [whole disk]" choice.
Next I'm going to change the type of files to search for (if you want to search for all file types then just skip next part and jump to my next post).

Use the right arrow key until the file opt is highlighted,
should now look similar to this.
Posted Image
Hit the enter/return key to see next screen.

Posted Image
Hit the s key on your keyboard to deselect all the choices, you'll see this removes the x from next to all the file types.
Now I only want mp3 and wav music files, (here you'll make your own choices on what file types you want to find, video, documents, etc.) so keep tapping the down arrow key(or just hold it down) until mp3 is highlighted then hit the spacebar to select it (shown with an x ).
Posted Image

I also want wav files so carry on tapping the down arrow key until riff is highlighted (now this adds the wav type files but as you can see below, this will also add any cdr and avi files it finds).
Hit the spacebar again to select it.
Posted Image
Now hit the enter/return key to return to last screen.


Edited by terry1966, 18 October 2011 - 06:20 PM.


Register to Remove

#2 terry1966



  • Visiting Tech
  • PipPipPipPipPip
  • 2,988 posts

Posted 18 October 2011 - 06:15 PM

Using photorec continued
Use the left arrow key to highlight "search" (if it's not already highlighted) and hit the enter key.

Posted Image
Here you need to know how the drive/partition was formatted. Only Linux users will probably have an ext type drive/partition so most people will use the already highlighted other and just hit the enter/return key.

You only see this next screen if you chose to search a partition and not the whole drive.
Posted Image
Here you have to choose whether to search the [whole] partition or just the [free] unallocated space on that partition (in other words space that would show as empty on your Windows OS. It's the one you'd choose if you were searching for a deleted file that couldn't be found any other way). Use the up/down arrow keys to make your choice and hit the enter/return key.

Posted Image
This is a very important part. Choosing where you're going to save the found files. Please get this right. You may overwrite the lost files you're trying to find, with no chance of recovering them if you don't.
You can see from the picture the Directory it's going to use at the moment is /root/ testdisk-6.12.
We need to change this, so hit the left arrow key twice until the Directory shows / .
Now use the down arrow key to highlight the mnt choice (and why we needed to mount all drives/partitions earlier, so they would show in here).
Posted Image
Hit enter/return key.

Now use the down arrow key again to highlight the partition where you're going to save the files, for me this is sdb1.
Posted Image
Now hit the enter key.

Posted Image
Here you will see any folders you may have on that partition. Just leave the top choice highlighted and hit the c key on your keyboard to start the search.
Posted Image
The time it takes to do the search depends on your PC and how big the drive is.
When it's finished searching you'll get the results.
Posted Image
You can see it found 293 files and saved them in a folder called recup_dir (not bad considering there were no music files on that drive except XP system files). :D
Now tap the q key on your keyboard until you get back to the console.
Close the console to finish.

Finding the files you were looking for
Now comes the time consuming and boring part. :pullhair:
If the files were important enough to need searching for though, you shouldn't mind it. :P
Click on the sdb1 icon on your desktop to open that drive/partition.
Posted Image
Here you will see the recup_dir.1 folder where the found files where saved, click on it to enter.
Posted Image
You can see the found files are all numbered and don't have the original file names. They do have the file type at the end .wav .mp3 etc.

You need to manually open/ listen/ watch each and every file (a lot may be unwanted system files, all 293 in my case. :rofl: )
Delete any unwanted ones and renaming the wanted ones as you go along.

You can do the above either in Puppy or you can exit out of Puppy and do it using your Windows operating system.

Hope this guide helps at least one person find that/ those very important file/ s that got lost by deletion or hard drive format. :thumbup:

photorecs official guide: http://www.cgsecurit...ec_Step_By_Step
This may help you get the original names back easier: http://www.cgsecurit..._Using_PhotoRec


#3 james321


    New Member

  • New Member
  • Pip
  • 1 posts

Posted 24 July 2012 - 04:14 AM

I was looking to find posts on this particular topic and your post came up first on Google search and finely i have found your post that is even slightly related to what I need Nice post. i have very impressed to see this post. i have benefited from the information you have given. nice work keep it up.

#4 terry1966



  • Visiting Tech
  • PipPipPipPipPip
  • 2,988 posts

Posted 24 July 2012 - 08:12 AM

thank you very much for your kind words. photorec is a great tool and i'm glad it was able to help you with your problem. :popcorn:

Edited by terry1966, 24 July 2012 - 08:32 AM.

#5 manoj aravind

manoj aravind

    New Member

  • New Member
  • Pip
  • 1 posts

Posted 21 May 2013 - 06:03 AM

Thank you very much for the nice useful post. It was very helpful after I mistakenly formatted my system unable to access, 70 GB of important data. Wish the images / screenshots were accessible after 2 yr of your writing the post. Even without them it was quite helpful. Thanks again.

#6 terry1966



  • Visiting Tech
  • PipPipPipPipPip
  • 2,988 posts

Posted 21 May 2013 - 11:22 AM

glad it helped you still. :thumbup: sorry about the missing images, they must have got lost during the sites recent upgrade. will ask someone to see if they can be found and restored. :popcorn:


found the problem, the site hosting the pictures shut down without warning, and like an idiot i didn't feel the need to keep my own copies when i made the guides.

Edited by terry1966, 18 November 2014 - 09:52 AM.

Related Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users