54

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?

Pablo Bianchi
  • 17,371
tomoqv
  • 879

4 Answers4

65

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.

oldfred
  • 12,583
10

The simplest way to fix backup GPT is:

sgdisk -e <target-device>

for example:

sgdisk -e /dev/sda

As documented in the manual the -e option:

-e, --move-second-header: Move backup GPT data structures to the end of the disk. Use this option if you've added disks to a RAID array, thus creating a virtual disk with space that follows the backup GPT data structures. This command moves the backup GPT data structures to the end of the disk, where they belong.

Diego
  • 343
5
fdisk /dev/your_device

Then type "w" and Enter.

midenok
  • 848
  • 1
  • 10
  • 15
2

Not exactly sure, but when I have two disks part of software raid (MDADM) I get this message. I damaged the array trying to remove this message. I was forced to recreate the array, and I still get this message. Since the array works, but I still get this message, I am just going to live with the message instead of trying to remove/fix it.

barrypicker
  • 1,293