This post will describe how to approach restoring a USB drive with a corrupted GPT, or MBR structure.
The following is a description of the disk failure that prompted me to find a partition table repair method.
The drive:
3.5TB USB EFI hard drive with 4 partitions:
1-NTFS (place holder to allow MS windows to see the contents on partition 4)
2-ext4 (puppy installation partition containing frugal installs)
3-ext4 (linux formatted bulk data partition)
4-NTFS (windows formatted bulk data partition mirroring partition 3)
I've been using this drive for a few years to boot puppies off partition #2. I went to check the boot flag and initiated g-parted, but it reported just one 3.5TB empty partition of unallocated space. The reason I ran g-parted was because grub4dos reported that there wasn't a boot flag while doing a frugal install on partition #2. Which seemed unusual.
I ran fdisk in the terminal and got this output:
Code: Select all
The primary GPT table is corrupt, but the backup appears OK, so that will be used.
Disk /dev/sdb: 3.65 TiB, 4000787029504 bytes, 784037167 sectors
Disk model: BUP Portable
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (mininum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5483CBF3-2749-439F-9AD6-08DCBAB79A8D
Device Start End Sectors Size Type
/dev/sdb1 ---------------------------- EFI System
/dev/sdb2 ---------------------------- 82.5G Linux filesystem
/dev/sdb3 ---------------------------- 1.8T Linux filesystem
/dev/sdb4 ---------------------------- 1.8T Microsoft basic data
note: dashes are fillers for the numeric values I didn't feel like typing
So apparently the partitions, and data were most likely still intact, as the sizes of the partitions and start and end sectors seemed to make sense, but more importantly fdisk reported that the backup GPT table was OK. So there was no guarantee that it could be re-stored, but there was still a chance.
The question was: what should I do next to restore the gpt table?
continued below....