30

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?

  • I would NOT recommend using the MiniTool software (used over the years mostly successfully). I recently attempted to partition an SD Card with the software and wound up with a real annoying GPT Partition Table that needed major fixing (or 5-10 mins of Googling but annoying all the same). Stick with Linux if you can and use either gdisk or fdisk to create your partition table. – Joe Johnson Nov 10 '18 at 15:33
43

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.

| improve this answer | |
  • 2
    Thanks, that fixed the issue! Now to another question, is it possible to merge two separate blocks of unallocated space and in that case, should I? – tomoqv Dec 6 '13 at 7:05
  • 6
    Note that gdisk also has a v command that should turn up details about most GPT problems. Also, this page describes gdisk's repairing options. As to merging two separate blocks of unallocated space, that's done in GParted or the like by moving intervening partition(s). This is a risky operation, so do it only if necessary. Alternatively, you could create two partitions and use LVM to create a logical volume that would span both partitions, even though they're non-contiguous. – Rod Smith Dec 6 '13 at 18:13
  • 1
    CAREFUL - my disks were part of a software raid array. This command changed the partition type from "Linux raid autodetect" to "Linux filesystem" and now my raid array superblocks are missing. (I have a backup). – barrypicker Jan 3 '18 at 18:22
  • I lost my all files operating system, now hard disk show unallocated spaces. Don't follow this answer. – Praveen Yadav Aug 14 '19 at 14:40
  • 1
    Best to backup current partition table before trying to make changes: sudo sfdisk -d /dev/sda > PT_sda.txt Belst to then start your own question, posting your details. – oldfred Oct 17 '19 at 18:10
1

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.

| improve this answer | |
  • I know it's been a while but I'm facing a similar issue now :) When you say the message came back after rebuilding the array, can you confirm that (a) the message went away after using gparted and (b) it came back after recreating the array? If so, can you remember how you recreated the array? I'm thinking of failing, removing, gparting and re-adding the drives. Thoughts? – jmlnik Jun 13 '19 at 13:26
  • 1
    Figured it out. In my case, I built the raid with whole-devices (instead of using partitions - that's a debate for another day). All I had to do was "zap" the GPT and MBR tables using gdisk /dev/sdX with options x and z – jmlnik Jun 14 '19 at 5:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.