The partition table of a hard disk holds all the information about where each partition begins and ends. If the partition table gets deleted or becomes corrupt in some way, most likely your operating system will not be able to boot or you will face other hard disk issues. But there is good news: if your partition table is lost, it is possible to recover it using software such as testdisk.
In this tutorial, we will go over the step by step instructions of booting into recovery mode, installing testdisk, and recovering a deleted partition table on a Linux system. After successful recovery of the partition table, you should be able to boot back into your Linux distro and go about using the system as normal – at least if there are no other underlying issues.
In this tutorial you will learn:
- Where to download a live Linux ISO for recovery
- How to boot into live / recovery mode
- How to install testdisk
- How to recover a deleted partition table
|Requirements, Conventions or Software Version Used
|Any Linux distro
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to recover partition table in Linux step by step instructions
In order to start with the recovery of the partition table, we will need to boot into the live CD mode of a Linux distro. It does not really matter which distro you decide to use for this, but we will be covering the instructions for Ubuntu Linux, as we must pick one to cover and can’t possibly cover every distro or Live CD out there.
You can download an Ubuntu ISO from Ubuntu’s download page or check out our guide on Live CD/DVD Linux downloads
if you want to use a different distribution. Afterwards, create a bootable USB drive with your ISO or burn a live CD or DVD.
- With your boot media inserted, turn on the computer and boot into live mode. In the case of Ubuntu, that means clicking on the “Try Ubuntu” option.
- Once you are loaded into the live environment, open a terminal and install the
testdiskpackage with your distro’s package manager. In the case of Ubuntu, the commands would be:
$ sudo add-apt-repository universe $ sudo apt install testdisk
- Once installation is complete, launch
testdiskwith the following command.
$ sudo testdisk
- Select the
No Logoption and proceed.
- Highlight the disk that has the deleted partition you need to recover, and select
- Select the partition type. Most likely this will be
Intel/PCunless you are using a more specialized system.
- Proceed with the
Analyseoption to search for partition tables.
- Choose the
Quick searchoption to locate partition tables.
- Highlight the found partition, simply called
Linuxin our case, and press
Enterto proceed with recovering the partition table.
- If the partition table looks correct to you, choose the
Writeoption to recover it.
- Testdisk will ask once again if you want to confirm these changes. Answer
- When done, quit out of the testdisk menu.
- Now you can reboot your system for the changes to take effect. Also be sure to eject your boot media before doing so.
In this tutorial, you saw how to recover a partition table on a Linux system. This was accomplished through the
testdisk software, which comes in as a real life saver when if you accidentally delete your disk’s partition table or it becomes corrupt in some way. After recovery, you should be able to boot back into your operating system like usual.