Recovering a partition table in Linux can be a delicate process, and it’s essential to proceed with caution to avoid data loss. Here’s a general guide to recover a partition table using the testdisk
utility, a popular tool for partition recovery on Linux systems.
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.
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
testdisk
package with your distro’s package manager. In the case of Ubuntu, the commands would be:
$ sudo add-apt-repository universe $ sudo apt install testdisk
3. Once installation is complete, launch testdisk
with the following command.
$ sudo testdisk 4. Select the No Log option and proceed. 5. Highlight the disk that has the deleted partition you need to recover, and select Proceed when ready. 6. Select the partition type. Most likely this will be Intel/PC unless you are using a more specialized system. 7. Proceed with the Analyse option to search for partition tables. 8. Choose the Quick search option to locate partition tables. 9. Highlight the found partition, simply called Linux in our case, and press Enter to proceed with recovering the partition table. 10. If the partition table looks correct to you, choose the Write option to recover it. 11. Testdisk will ask once again if you want to confirm these changes. Answer Y to proceed. 12. When done, Quit out of the testdisk menu.
Remember, partition recovery is a sensitive operation, and there is no guarantee that all data can be recovered. Always have a backup of your important data to prevent any permanent loss.
Now you can reboot your system for the changes to take effect. Also be sure to eject your boot media before doing so.