I solved the problem using GNU Parted.
Other methods of recovering are mentioned in the Ubuntu Documentation.
Advantage of choosing GNU Parted:
No need to download it, it is included in Ubuntu base.
How to use GNU Parted
Run Parted from the command line to recover your partition.
When changing the partition table on your hard drive, you must ensure
that no partition on the disk is mounted. This includes swap space.
The easiest way to accomplish this is to run the live cd. Parted is
installed on the base Ubuntu system. Once at the desktop, open a
terminal and run_:
sudo swapoff -a or you can use Gparted partition editor to achieve the same. Next run parted and tell it to use the device in question.
For example, if your /dev/sda drive is the drive from which you want
to recover, run:
sudo parted /dev/sda
Enter the following command to ensure the unit used is 's':
Now you can use the print and rescue command to recover your partition as explained in the user manual as follows:
Enter the following command to get details of all partitions and their start and end locations:
Now we can enter the final rescue command:
rescue START END
Use the values for start and end from the output of the
If you have more than one partition to recover, repeat you rescue command.
You won't need to restore GRUB.