4

From Ubuntu running from CD I formatted the C: drive using GParted and I changed the partition table on one HDD from MBR/MSDOS to GPT but I realized (too late) that it affected all partitions on the same HDD. Basically I lost data on the secondary partition which I wanted to keep.

I used GParted to perform the change of partition type. I did not do anything else since and the entire HDD is unallocated now.

How can I recover partitions with files please ?

Zatigem
  • 517

1 Answers1

4

1) Get the path of your drive

First, open GParted or Disks and fetch the device path of your HDD (see the screenshot below): dev sda

Here the HDD is at /dev/sda.

2) Backup your data if possible

It is highly recommanded to create an image of your HDD before attempting any rescue.

To create an image, use Disks. Select your HDD at /dev/sda then click on the 3 vertical dots (disk options) and "Create a disk image…".

3) Use Test Disk to recover your lost partitions

Install Test Disk with:

sudo apt install testdisk

Then run it for your drive with /dev/sda, the path you fetched on the first step:

sudo testdisk /dev/sda
  1. You’ll have to confirm the media, press ENTER on [Proceed] for /dev/sda,
  2. Then choose the right partition table type. In your case it’s [EFI GPT]. and ENTER,
  3. Choose [ Analyse ] and ENTER.
  4. ENTER on [Quick Search].
  5. Now Test Disk is showing your lost partitions. Press ENTER to continue
  6. If you have found all your lost partitions, and ENTER on [ Write ]. If you haven’t found them, try a [Deeper Search].
  7. Confirm with Y and ENTER on [Ok]
  8. Reboot or unplug and plug your drive A

Hurray, all your partitions are back !

Zatigem
  • 517