I just lost the partition table on a drive with a non-standard layout and managed to get the data back… phew.
I originally had something like:
1 2 3 4 |
|
Note: partition table above is from a VM I spun up to write this entry.
That is to say I had a drive dual booting Linux and Windows, with Windows at the end of drive (because Russel sort of implied it was better).
The person who owns the drive in question wanted all the space claimed by Linux reallocated back to Windows.
After confirming backups of critical documents I fired up gparted in a live CD… which all seems swimmingly ok until the Laptop powered off (because the power plug had dropped out and the battery went flat).
After trying to boot up I discovered a corrupted partition table.
This would probably be ok (given the backups of documents) if not for the fact that I had no appropriate Windows installation media and the owner of the Laptop couldn’t find the original installation disks.
Oh noes! (I scream loudly inside my head so as not to alarm the owner of the Laptop)
After booting back in to the live CD I have a partition table that looks more like this:
1 2 3 |
|
“Ok” I hear you saying “just rewrite the partition table with the output you saved from "fdisk -l” before starting. “Oh you didn’t save the output before starting…”
After a bit of hair pulling (and googling) I come across gpart.
It found the old partition without breaking a sweat:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
After talking to fdisk nicely I was able to convince it to create the partition table that gpart was suggesting and subsequently able to mount, resize properly and validate the partition with Windows chkdsk tool… phew, crisis averted.
Next time I’m dding the disk to a USB drive first, no matter how long it takes.