Friday, August 29, 2014

Recovering files from a formatted hard drive in Linux

Recently I received a request to recover some outlook email files in PST file format in a formatted hard drive. The hard drive was in a laptop which ran Microsoft Windows 7 operating system. By some mistake, the owner has formatted the hard drive and reinstalled the operating system. The requirement is to recover the Outlook emails saved in PST format.

First thing I did was booting the laptop with a 64-bit version of Ubuntu 12.04 live CD. I configured the network setup for the live booted operating system to access Internet through the Ethernet cable. Then I needed to install some tool. For that, I opened the "Update Manager" application and clicked on the Settings button which opened the "Software Sources" window. There, I should remove the check of the "Installable from CD-ROM/DVD" option and then put check on "(universe)" repository.  Now, open a terminal and give the following commands to install the required tool.

sudo apt-get update
sudo apt-get install testdisk

Once the installation gets completed, we can start our data recovery adventure. Since these PST files are so huge, we need a good external storage to hold the recovered files. Therefore I plugged-in a large enough USB drive. Run the command "sudo photorec" in the terminal to start. This tool came with that "testdisk" tool which we installed. When this tool open in the terminal, there are many options you can do. Since it's hard to explain everything, I will just mention the most important things.

Once we open the photorec tool, it will show our hard disk in the laptop. Select the "Proceed" option which will take us to show the partitions inside the hard disk. In this new window, you will see four options and among them what is important is "[File opt]" option where we can select the types of files which we want to recover. Since I wanted only .pst files I just kept the check for that file type and removed the rest. Finally, select a particular partition and take the "[ Search ]" option to start searching for the specified file type in that partition. A destination directory should also specified where the recovered files will be saved. I chose my USB drive as that destination.

The recovery will take a long time depending on the size of each partition. Once the recovery is completed I got the recovered .pst files in the destination directory. These files should be importable into Microsoft Outlook. In case we need to convert the recovered .pst files into some other format, for example for exporting into Gmail or Thunderbird, we need some conversion tool. One such a good tool is "readpst" which we can install from the following command even though I haven't used it for some serious work.

sudo apt-get install readpst

I hope all these tools will help someone to recover their lost data.

No comments:

Post a Comment