This article explain you how to recover the lost or deleted partition in linux. Losing of disk partition is occur due to sudden power off or some other problem like accidently deleting the hard disk partition by the users. In this cases, if you want to recover the losted disk partition their is so many recovering tools are availble on linux. In this article we will use the gpart to recover the disk partition.
The gpart is guess PC-type hard disk partitions, that tries to recover the hard disk partitions. This gpart have limitation, It can only detect the following type of partitions.
To add more filesystem for guessing, modules can be added at runtime
To recover the lost or deleted partition of your hard disk, first boot the system with a linux OS CD that what flavour you used in that crashed disk finally.
Then go to rescue mode with that Linux OS CD, that bring you to a rescue mode .
Now you put the following command for available disk partition checking
# fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
18 heads, 4 sectors/track, 4341414 cylinders
Units = cylinders of 72 * 512 = 36864 bytes
Device Boot Start End Blocks Id System
This show no partition on your disk, it means all the partiotions are losted.
Now run the below command
# gpart /dev/sda
The output of the above command will be like this
This command will show’s the all guessed partitions available on the hard disk. Now verify the result that showing the lost partition of your disk correctly or not.
After verifying the output write the the partition table by using the -W option on gpart command
# gpart -W /dev/sda /dev/sda
it can be written the guessed disk partition to the specified file or device on your hard disk. now you got back your deleted partition successfully .