Continued from Recovering Windows files with a Ubuntu CD II: getting your files
Usually when you delete a file from your computer, the file is still there—its space, however, is marked as available for use. Even if you reformat your hard drive and reinstall Windows (I had a friend who did this by accident, and I used Ubuntu to save her data), most of your data is probably still there.
Assuming you were able to boot the Ubuntu CD and it properly detected your internet connection, you can use a program called Photorec to recover your personal files.
If Ubuntu does not automatically detect your internet connection, and you have access to the internet on another computer, you can download the appropriate two installer files from here and here. Find a way (by USB key or iPod) to transfer them to the computer running the Ubuntu live session, and double-click libntfs10 to install it, and then double-click testdisk to install it.
This may be a bit confusing—the program we want to use is called photorec, but the program we want to install that allows us to use Photorec is called testdisk. Also, the program is called Photorec, but it recovers many types of files, not just photos.
Installing testdisk to use Photorec
First, we’re going to install the program we need in order to use Photorec.
Click on System > Administration > Synaptic Package Manager. This will open a software management program that will fetch and install software for us.
Click on Settings > Repositories.
Make sure all the checkboxes are checked (or ticked), except the CD-ROM source at the bottom. Then click Close.
Click Close again.
At the top-left corner of the Synaptic window, click Reload and wait for the new software package information to download.
Now that we’ve told the software manager to find all the software that’s available for installation, let’s install it. Click Search in the Synaptic window, in the search box type testdisk, and then click Search in the dialogue window.
testdisk should appear in the results. Right-click it and select Mark for installation.
In the Synaptic window, click Apply, and then confirm you want to apply changes by clicking Apply in the dialogue window as well.
Wait for the software to download and install.
Quit the software manager.
Prepare backup location
You can use an external hard drive or even internal second hard drive for backup.
For an internal second hard drive, you can access it the same way you accessed the internal first hard drive (the one you’re trying to recover data from).
If the backup location is an external hard drive, you should be able to plug it in and have it automatically appear on the desktop as an icon.
Go to Applications > Accessories > Terminal
in the command prompt window that appears. This will show you the path to the backup location. In this example, the backup location I’m using is 2.8 GB large, so I must make a note that it is available at /media/disk-2.
In Windows, new drives “mount” (or become available for use) as new letters (D:, E:, F:, G:, etc.). In Ubuntu, new drives mount as folders inside an all-encompassing directory. The top-level directory is slash (/). Inside that directory is subdirectory called /media, which has inside of it another subdirectory called disk-2. That’s where I want to send the recovered files to.
Recovering files with Photorec
Before you run Photorec, maximize the command terminal window. To run it, you need to run the command
Don’t try to run the command photorec without sudo, as I tried to do earlier in the screenshot.
Photorec is a terminal program, so your mouse won’t work in it. You can navigate its menus with your arrow keys and then select your choices with the Enter key.
The media you are selecting is the drive you want to recover files from. Then click Enter to proceed to the next step.
Select the appropriate partition type. If in doubt, select Intel.
Select to search the whole disk.
Since this tutorial is aimed specifically at recovering Windows files, you’ll most likely choose Other for filesystem type.
This is where things get a little tricky. Photorec will assume you want to back up to a folder in Ubuntu’s /home/ubuntu directory, but you probably want to back up to an external drive (in this example, it’s /media/disk-2).
To go up a directory, go to the double-dot and press the right arrow key.
Do the same to go up yet another directory.
Select media and hit Enter.
Select the drive you want the recovered files to be saved to. In this case, it’s /media/disk-2.
Once you’ve selected the backup drive, type
Wait for Photorec to scan for files. Depending on the size of your drive, this could take a really long time. The drive I scanned for this example is only 8.7 GB and took about 15 minutes to scan. If you have a 160 GB drive, well, you do the math.
When it’s done, you can select Quit.
Select Quit again.
Yes, select Quit a third time.
To exit the command terminal, type
Checking the recovered files
If you look at the backup drive, you should see a bunch of folders full of recovered files.
Every folder will have a mix of different file types. Some files will be music files. Others will be Word documents. There will be pictures and text files. All sorts of stuff you may not even care about. The labels will be random, so even though you have your files back, it’ll be up to you to reorganize them and rename them appropriately.
To get out of the live CD, go to System > Quit.
Select the appropriate option, probably Restart.
Wait for the live session to fully end, and then press Enter to reboot after the CD ejects.
After you reboot into Windows, you should be able to access the recovered files.
Congratulations! You just saved yourself hundreds of dollars, learned something new, dabbled in Linux (Ubuntu specifically), and didn’t give up access to your computer for days or weeks.
You should, of course, always back up your files, but it’s also good to know there are free and easy ways to recover your data otherwise.
If you need any help with this process, please feel free to post a support thread in the Absolute Beginner subforum of the Ubuntu Forums.