Note, TestDisk is also available on or under the following distributions, many of which have a console/rescue mode that can be used to run TestDisk or PhotoRec: ALT Linux: apt-get install testdisk ArchLinux User-community Repository: pacman -S testdisk or yaourt -S testdisk. Here is how to repair it: Via an Ubuntu disc Step 1 - Boot on a liveCD or liveUSB Boot your computer on a Ubuntu live-CD or live-USB, then choose 'Try Ubuntu'. / / In this tutorial we’ll talk about TestDisk and PhotoRec in Ubuntu and Linux Mint.is file data recovery software designed to recover lost files including video, documents. This is a step by step tutorial shows you how to install the real Ubuntu OS on USB stick to create a ‘Windows To Go’ style USB drive. Tested with Ubuntu 14.04. Requirements: Before getting started, you need to prepare something: A 8GB+ USB Drive. A Ubuntu Live CD/DVD/USB. In the case below, I created a bootable Ubuntu Live USB from the.iso.
A friend recently asked me to perform a system recovery on her VAIO laptop. The hard disk was split between a C drive for the OS, and a D drive with 200GB of data. I'm a Linux user, so I was like, come on, at least give me a challenge! Have you heard people saying, be careful what you wish for? Well, 30 seconds into the recovery procedure, I got an Error 333
and a restart button. Both partitions had been deleted.
The good news was that before I started the system recovery procedure, I asked her to backup the most important data, but that was just 5GB out of 200GB—the rest was gone. That's a lot of lost data! Thankfully, I was able to use a cool program called TestDisk to fully recover everything.
In this tutorial, I will show you how to create a bootable GParted Live USB drive, and use TestDisk to recover your partitions. Note that if you are still able to boot normally to your system, and just want to recover your files without creating a bootable disk, you might also want to have a look at Recover Deleted Files Using the Free Open Source Tool PhotoRec.
Start by downloading the GParted Live ISO. Choose the latest stable release for your computer architecture (if you are not sure choose i686). There are multiple methods you can use to create a bootable USB drive from the ISO file—I prefer UNetbootin.
If you are on Windows, just download UNetbootin.
If you are on Ubuntu, ensure you have the latest version by adding the Ubuntu PPA repository for UNetbootin and install it.
$ sudo add-apt-repository ppa:gezakovacs/ppa
$ sudo apt-get update
$ sudo apt-get install unetbootin
For other distributions, you can find binaries and sources at the official UNetbootin page.
After installing, plug-in an empty USB drive and run UNetbootin. Select the GParted ISO you have just downloaded and the drive you wish to use for GParted Live, and then click OK.
Restart your computer and boot from the USB drive you have created. While GParted is booting it will ask you some questions, e.g. keyboard layout, don't try to be a hero, just accept the defaults by pressing Enter
. When the window manager loads, the first open window is the GParted Partition Editor.
Select your disk drive using the drop-down menu on the top-right. I have selected /dev/sdc
, which as you can see doesn't have any valid partitions on it, since I accidentally deleted them for this tutorial.
Open the terminal window, by double clicking on the terminal icon on the desktop, and run TestDisk as root:
$ sudo -s
$ testdisk
Follow the steps below:
Select No Log
.
Select the disk drive you want to recover, e.g. /dev/sdc
.
Select your partition table type. Usually it's Intel
.
Select Analyse
and Quick Search
.
If you get asked whether your partition was created under Vista, answer yes/no
.
Your drive will be analysed and you will see a list of all found partitions. If you know what you are doing, you can edit the list, otherwise just press Enter
.
On the next screen you have the option to either perform a second Deeper Search
, or Write
the current partition table to disk. If the quick search was successful, choose Write
.
Quit TestDisk, and rescan your devices in the GParted Partition Editor by clicking GParted
→Refresh Devices
. Select your device from the top-right drop-down menu.
If your deleted partitions were successfully recovered, as in the above screenshot, you can reboot your computer by double clicking on the Exit
button.
You can learn more about TestDisk by looking at the official documentation.
This recovery example guides you through TestDisk step by step to recover a missing partition and repair a corrupted one. After reading this tutorial, you should be ready to recover your own data. Translations of this TestDisk manual to other languages are welcome.
We have a 36GB hard disk containing 3 partitions. Unfortunately;
This recovery example guides you through TestDisk, step by step, to recover these 'lost' partitions by:
Recovery of a FAT32 partition (instead of an NTFS partition) can be accomplished by following exactly the same steps. Other recovery examples are also available. For Information about FAT12, FAT16, ext2/ext3, HFS+, ReiserFS and other partition types, read Running the TestDisk Program.
One condition:
Important points for using TestDisk:
Arrow
and PageUp/PageDown
keys.Enter
key.y
(Yes) and/or Enter
keys, andEnter
key.If this hard disk's primary partition contained an operating system, it would most likely no longer boot up - due to its corrupted boot sector. If the hard disk was a secondary (data) drive or you can connect the drive to another computer in its secondary channel (usually where a CD/DVD drive is connected), the following symptoms would be observed:
The drive is not formatted, do you want to format it now?
If TestDisk is not yet installed, it can be downloaded from TestDisk Download. Extract the files from the archive including the sub-directories.
To recover a lost partition or repair the filesystem from a hard disk, USB key, Smart Card, etc., you need enough rights to access a physical device.
testdisk-6.13/testdisk_win.exe
) from an account in the Administrator group. Under Vista, right-click testdisk_win.exe and then 'Run as administrator' to launch TestDisk.sudo testdisk-6.13/testdisk_static
)testdisk-6.13/testdisk
) will restart itself using sudo after confirmation on your part.To recover partition from a media image or repair a filesystem image, run
testdisk image.dd
to work from a raw disk imagetestdisk image.E01
to recover files from an Encase EWF imagetestdisk 'image.???'
if the Encase image is split into several files. To repair a filesystem not listed by TestDisk, run testdisk device
, i.e.
testdisk /dev/mapper/truecrypt0
or testdisk /dev/loop0
to repair the NTFS or FAT32 boot sector files from a TrueCrypt partition. The same method works with filesystem encrypted with cryptsetup/dm-crypt/LUKS.testdisk /dev/md0
to repair a filesystem on top of a Linux RAID device.All hard drives should be detected and listed with the correct size by TestDisk:
If available, use raw device /dev/rdisk*
instead of /dev/disk*
for faster data transfer.
TestDisk displays the partition table types.
TestDisk displays the menus (also see TestDisk Menu Items).
Now, your current partition structure is listed.Examine your current partition structure for missing partitions and errors.
The first partition is listed twice which points to a corrupted partition or an invalid partition table entry.
Invalid NTFS boot points to a faulty NTFS boot sector, so it's a corrupted filesystem.
Only one logical partition (label Partition 2) is available in the extended partition.One logical partition is missing.
TestDisk displays the first results in real time. | (click on thumb to display the image). |
During the Quick Search, TestDisk has found two partitions including the missing logical partition labeled Partition 3
.
All directories and data are correctly listed.
Extd Part
gives you the opportunity to decide if the extended partition will use all available disk space or only the required (minimal) space.Deeper Search will also search for FAT32 backup boot sector, NTFS backup boot superblock, ext2/ext3 backup superblockto detect more partitions,
it will scan each cylinder | (click on thumb). |
After the Deeper Search, the results are displayed as follows:
The first partition 'Partition 1' was found by using backup boot sector.In the last line of your display, you can read the message 'NTFS found using backup sector!' and the size of your partition.The 'partition 2' is displayed twice with different size.
Partitions listed as D(eleted) will not be recovered if you let them listed as deleted.Both partitions are listed with status D for deleted, because they overlap each other. You need to identify which partition to recover.
Partition 2
and press p to list its data.The file system of the upper logical partition (label Partition 2) is damaged | (click on thumb). |
Partition 2
with a damaged file system marked as D(deleted)
.Partition 2
belowIt works, your files are listed, you have found the correct partition!
Note: FAT directory listing is limited to 10 clusters - some files may not appear but it doesn't affect recovery.
Using the left/right arrow keys, change the status of the selected partition from D(eleted)
to L(ogical)
. This way you will be able to recover this partition.
set partition to recover |
Hint: read How to recognize primary and logical partitions?
Note: If a partition is listed *(bootable) but if you don't boot from this partition, you can change it to Primary partition.
It's now possible to write the new partition structure.
Note: The extended partition is automatically set.TestDisk recognizes this using the different partition structure.
Now, the partitions are registered in the partition table.
The boot sector of the first partition named Partition 1
is still damaged. It's time to fix it.The status of the NTFS boot sector is bad and the backup boot sector is valid.Boot sectors are not identical.
y
to confirm and next OK.More information about repairing your boot sector under TestDisk Menu Items.The following message is displayed:
The boot sector and its backup are now both OK and identical: the NTFS boot sector has been successfully recovered.
Enter
a last time and reboot your computer.TestDisk can undelete
If it doesn't work or for other filesystem, try PhotoRec, a signature based file recovery utility.
Return to TestDisk main page