Ubuntu – Fixing corrupt backup GPT table

partitioning

After successfully installing a dual boot environment, adding Ubuntu 13.10 to a preinstalled Windows 8 configuration I decided to increase the unallocated SSD disk space after reading about the benefits of over-provisioning. So, using miniTools Partition Wizard in Windows, I shrunk the NTFS Windows partition somewhat. That seem to have completed successfully. However, when I boot up Linux and launch GParted, it gives the following error message at startup:

The backup GPT table is corrupt, but the primary appears OK, so that will be used.

Everything seems fine and dandy with the system, but I am worried that I will have a problem should the main GPT table become corrupt for some reason.

I have used gdisk to backup the GPT table to a file, but is there a way to create a new backup GPT table?

Best Answer

Best to backup partition table first, just in case changes are not correct. Then it is possible to restore old partition table. If drive is sda & save to another drive:

sudo sfdisk -d /dev/sda > PT_sda.txt

Use gdisk and verify partitions are correct with p, and use w to write the partition table. If not correct just use q to quit. That should update primary, backup & protective MBR.

sudo gdisk /dev/sda
Command (? for help): 

b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu

Be sure to see comment below by Rod Smith, he is author of gdisk at his rodbooks site.