Hi all, today we'll be helping you guys to recover data from your formatted or virus corrupt USB Flash(Pen drive) , Hard Disk, Memory Sticks, etc in Linux. In this tutorial we'll be using PhotoRec, a package of TestDisk.
TestDisk is a free and Open Source Software which was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table).
If you accidentally deleted your data or you formatted your USB flash or your friend running Virus full Windows corrupted it then, PhotoRec is an awesome tool for you to choose for Data Recovery.
- Fix partition table, recover deleted partition
- Recover FAT32 boot sector from its backup
- Rebuild FAT12/FAT16/FAT32 boot sector
- Fix FAT tables
- Rebuild NTFS boot sector
- Recover NTFS boot sector from its backup
- Fix MFT using MFT mirror
- Locate ext2/ext3/ext4 Backup SuperBlock
- Undelete files from FAT, exFAT, NTFS and ext2 filesystem
- Copy files from deleted FAT, exFAT, NTFS and ext2/ext3/ext4 partitions.
Here are the steps that you'll need to follow to use photorec to recover data from the memory device:
1. Installing PhotoRec
First we'll need to update our repository index using the command below, I am running Ubuntu 14.04 LTS (Trusty) so I will go for sudo apt-get update. It differs by distro used:
sudo apt-get update
Then, We'll gonna install testdisk which includes the package PhotoRec in it.
sudo apt-get install testdisk
Note: PhotoRec is included in testdisk, so you'll no need to install photorec separately.
2. Recovering Data
Ok, now we'll go towards or real and important stuff ie Recovering our deleted data or formatted USB stick. For that we'll gonna run photorec. Photorec allows you to recover every type of data from the device.
The above command will show you the list of the memory devices detected by your computer as shown in the figure below:
Then, we'll gonna select the partition which we have the data and we'll wanna select it. If we know the format of data we need to recover, you select File Opt option in the menu. You can do that by pressing right button.
You can select the format by pressing spacebar and then, press b to save the changes.
Then, previous menu will come, then select Search to search for the lost data.
Then, We'll gonna select the location where to save. Note: Please do not select directory of the memory device for the destination.
Select .. to go back, Enter to get into the directory and press C when you are done to choose that as destination.
After you select the directory, the program will start fetching the data you want to get recovered. After it is done, you'll be able to browse your files in the place where you have selected the destination to save.
Yes, now we are done. We have successfully recovered the required data from our memory stick using Photorec. You can visit the website of PhotoRec if you need more information regarding these or can comment below.