1

I'm dual booting Ubuntu 13.10 beside Windows 8, and was having some problems with the installer not detecting Windows 8. I followed the suggestions in this answer: https://askubuntu.com/a/287862/118240 to use gdisk to zap the GPT table. After that, I could not boot into Windows 8; the boot goes directly to the USB drive with Ubuntu. Anyways, fortunately I had created a backup with the gdisk 'b' command. I restored the backup with 'r', 'l', and 'w'.

Now, upon loading, GParted shows the error: /dev/sda contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted - possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT partition table?

When I click yes, GParted shows my partitions, but with red errors that make me nervous:

GParted

Running sudo gdisk /dev/sda shows this:

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with corrupt MBR; using GPT and will write new protective MBR on save.

I don't have proof, but I'm 95% sure that before I zapped the GPT table, MBR said something other than not present. And I'm 50% sure it wasn't present, but I can't remember what (I'll probably remember in a few days when this is solved...).

I don't have any important data on Windows (I just purchased the computer), but I'd rather not have to re-install it (I'm don't know if I'd have to re-purchase Windows 8, as it shipped already installed on the computer and I don't have a CD?).

Anyways, can I safely write a new protective MBR with gdisk? Will that preserve my partitions, or have I done too much damage already? If not, are there any steps I can take?

Joel
  • 189
  • 2
  • 9
  • 1
    You last entry shows that gdisk will write a protective MBR with a write. So use gdisk and write the partition table. The protective MBR has just one partition table entry so old partition tools like fdisk will not try to write to it without at least showing that it is gpt. You only delete all gpt data if you install Windows in BIOS mode. But your Windows is UEFI and then can only be UEFI. Did you shrink Windows before backing it up with gdisk? Otherwise you should not have all that unallocated. – oldfred Dec 05 '13 at 04:58
  • Thanks for helping out! Yes, I shrunk Windows before backing it up. As for writing a protective MBR, here's what gdisk says after I enter the 'w' command: Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! This doesn't say anything about MBR. Why would it be writing GPT data? Am I on the right track? – Joel Dec 05 '13 at 05:05
  • As long as you still have your backup, I would go ahead. When you do a l from gdisk (not advanced) does it show current partitions. As that is what will be written. – oldfred Dec 05 '13 at 05:09
  • I ran the 'w' command, then 'Y' to confirm, and everything works now! GParted looks normal, and I can boot into Windows. @oldfred thanks for your help! Write an answer and I'll accept it. – Joel Dec 05 '13 at 05:19

1 Answers1

4

You last entry shows that gdisk will write a protective MBR with a write. So use gdisk and write the partition table.

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

at commands use p to list partitions, if they look ok then do a write at gdisk command. If not ok use q to exit. ? will show commands. It will just rewrite the gpt data, but also automatically write a correct protective MBR entry.

The protective MBR has just one partition table entry so old partition tools like fdisk will not try to write to it without at least showing that it is gpt. You only delete all gpt data if you install Windows in BIOS mode. But your Windows is UEFI and then can only be UEFI.

Your example of having a backup of the partition table just shows how important that is. Without the backup, recovery is difficult or maybe impossible.

oldfred
  • 12,100