Zap GPT data structures from a disk, while preserving existing MBR partitions

Using GPT partitions, or a GPT partitioning scheme, takes care of the shortcomings of the MBR partitioning scheme. However, if you are not careful, it could make things difficult for you. But don’t point fingers at the technology itself.

Back in November 2012, while attempting to dual-boot Ubuntu 12.10 and Windows 8 Pro on a solid state drive (SSD), I made an observation which I wrote about in Why is Windows 8 on SSD invisible to Ubuntu 12.10’s installer?. At that time, the most vexing thing was that I could not reproduce the problem on my regular hard disk drives (HDDs). And I could not figure out the solution.

Bartek Juszczak, a reader who commented on that article, suggested a very simple solution. I never bothered to try it out until yesterday when I made a first attempt to triple-boot Windows 7, Ubuntu 12.10 and Fedora 18 on the same SSD.

Even though I was using Windows 7 instead of Windows 8 Pro, it was the same problem all over again; Ubuntu’s installer could not detect the existing Windows 7 on the SSD.

Related Post:  How to install Iridium Browser on Ubuntu 16.10, Linux Mint 18.1

To give you an idea of the nature of the problem, take a look at this screen shot. If you’ve ever installed Ubuntu or any Ubuntu-derived distribution, you know that it’s from the partitioning methods step of Ubiquity, the graphical installation program of Ubuntu Desktop. Though it says that “This computer has no detected operating system,” there is a fresh installation of Windows 7 on it.
Ubuntu Ubiquity Installer

Even from the Advanced Partitioning Tool’s window, there is no evidence of any partition on it. Why? Based on Juszczak comment, and from my observation while attempting to implement his fix, it appears that the SSD had GPT partitions on it before Windows was installed. So the GPT data structures were confusing Ubiquity.
Ubuntu Advanced Partitioning Tool

After successfully implementing Juszczak’s fix, Ubiquity’s accurately detected the presence of Windows 7 on the SSD. If you are facing the same problem, this short article gives you a step-by-step guide, with screen shot, on how to remedy it.
GPT Partitions

I made the attempt to fix the problem while installing Ubuntu from the Live desktop. You will be working from a shell terminal, and be using Gdisk to mess with the disk. Since Gdisk is not installed in the Live environment, it will have to be installed using sudo apt-get install gdisk. After that, run the command shown in the screen shot below. The output reveals what the problem is: Presence of MBR and GPT partition tables on the same SSD. That’s why Ubuquity got confused.
GPT Partitions gdisk

Related Post:  Upgrade the kernel on Linux Mint 17.2

Since I installed Windows 7 using an MBR partitioning scheme, the reasonable option to select is “1.” I want to preserve the MBR partitions.
GTP Partitions Gdisk

Now that I’ve told Gdisk what I don’t want to destroy, it is expecting additional commands. Type “x” to see a list of command options.
GPT Partitions Gdisk

The option we are looking for is “z” (zap (destroy) GPT data structures and exit).
GPT Partitions Gdisk

Type “y” to confirm wiping the GPT data structures.
GPT Partitions Gdisk

Then “n” to preserve the MBR partitions. That’s it.
GPT Gdisk


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Hola! Did you notice that no longer run network ads?  Yep, no more ads from the usual suspects that track and annoy you across the Internet. But since I still need to pay to keep the site running, feel free to make a small donation by PayPal or your favorite cryptocurrency.

  • Bitcoin
  • Ethereum
  • Xrp
  • Bitcoin cash
  • Bitcoin sv
  • Litecoin
  • Binance coin
  • Cardano
  • Ethereum classic
Scan to Donate Bitcoin to bc1qzvlte2m224zkayhdc7fdfjkp2rsgt0l5a496ua

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x0F4362DFF77F3Ba0Dc637F5f3Eba35D09a2fA60C

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Xrp to r4ggjvL36njsMCYTkJ3S7cTHscPsMsSGQv

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Bitcoin cash to qrs0dedzp9t55af3nfwypydghp29r0xguy9s20fz2k

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Bitcoin sv to 15K9TLyVDBtLuG9cYvXCX9SSkq9C9oUKHK

Donate Bitcoin sv to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin sv

Scan to Donate Litecoin to LetJ9QQMb7u2LMZ9Tu6rtHwcBcQFW98fbG

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Binance coin to bnb1ga8trq08ssqepd90v6225nzfgy448pu5pw8gxp

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Cardano to addr1qx2354yw49etstfljpdhwja3ajjlt487lg95vu9ngy2q6vu4rf2ga2tjhqknlyzmwa9mrm997h20a7stgectxsg5p5esq5l7d9

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Ethereum classic to 0xcD6CC972a2297FcafACDcfE042C55C69516a9264

Donate Ethereum classic to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum classic

Subscribe for updates. Trust me, no spam!

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
4. Axo Finans.

Upcoming events

35 Responses

  1. hi,

    I tried to install ubuntu on my computer but I couldnt do it without erasing windows so Im trying your technique to solve it but it says my gpt is not existent and then I received this message:

    Found invalid GPT and valid MBR; converting MBR to GPT format
    typing ‘q’ if you don’t want to convert your MBR partitions
    to GPT format!

    and then

    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

    could you help me? Im running windows 7!

    thanks 🙂

    1. questions:

      1. Did you install Windows 7 yourself or is did it come with the PC?

      2. Is Windows 7 installed on MBR or GPT partitions? If MBR, then you can zap the GPT partitions.

      3. Can you see the Windows 7 partition from the advanced disk partitioning tool’s window?

      I’m trying to see whether we can install Ubuntu without going through the steps in this article. Whatever you want to do, first backup your data.

      If you can, try taking a screenshot of the partitioning type step and the advanced partitioning tool window and post them on a new post at the forum.

        1. Boot into the live desktop and restart the installation. At the installation type step, choose the Soemthing else option and take a screenshot of the advanced partitioning tool window.

          That should show all the partitions the installer detected on the disk. Post the image on a new post on the forum.

          I think it’s MBR, but I just want to make sure. Guide to disks and disk partitions in Linux is a good article on this topic.

          1. That looks like MBR, but I’d like to see it from the Ubuntu installer.

            What’s that 1.7 GB partition in front of the System partition?

            The partitioning scheme will be much clearer from Ubuntu’s installer, so let’s see that too.

  2. Hi, when i type in sudo gdisk /dev/sda, i get a list of the partiotion table but it says my MBR is protected and it says ‘Found valid GPT with protective MBR; using GPT.’ and just puts me straight into options, what do i do?

    1. Give me a bit more context. What version are you trying to install, are you attempting a dual-boot with what OS, and is your PC a UEFI system?

      1. Hi !
        I’ve got the same problem here.
        I’m trying to install Ubuntu 14.04.1 on dual boot with windows 8.1 (not pre-installed).
        My PC is UEFI.
        Can you help me ?

          1. I was scared that GRUB won’t recognize both Ubuntu and Windows( since Ubiquity does not) but if doesn’t seem to be a problem.
            Thx a lot !

  3. Hi ! I have tried the procedure because Ubuntu installer was enable to detect Windows.
    I have tried to installation again and i got this question:
    unmount partitions that are in use?

    Which I answered yes…. maybe that was a mistake. Ubuntu didnt recogniwe Windows any better so i did not continue installation. I cant boot on Windows now. Would you have any idea on how to get back my windows booting ??

    1. When you try to boot Windows, what happens? And do you have a Windows installation CD?
      Also, what version of Ubuntu are you trying to install and on what type of hardware?

  4. Hi,
    Since 2 months I was trying to dualbooting ubuntu with win 8 with uefi mode. before a month I read this post to resolve issue. but ubuntu installer cd was getting error after using
    sudo apt-get install gdisk command. Its saying that gdisk is
    only for basic not for gpt.

    But today I got direct installer package from…
    & installed that gptfdisk_0.8.8-1_i386.deb

    Thanks to you to inspire me to give me guidence of “Zap GPT data structures from a disk, while preserving existing MBR partitions”
    Because of that I successfully removed gpt structure & get option of Install ubuntu alongside with windows” option.

    thanks to forum again.
    good day !!

  5. so, I did this and it worked great, except then when I rebooted all I could boot to was the live usb and NOT windows 8.1 (on a lenovo yoga 2 pro) so in the end I just wiped the disk and installed ubuntu over windows. not what i was shooting for, but helped me commit to obliterating windows, so, well, um, thanks i guess??!!??!

    1. Ok, what I need now is a store-bought Windows 8 notebook. Unfortunately, I’m willing to give even 1 cent to MS, just so I can use the PC to write tutorials.

      Anybody willing to donate?

      1. thanks for what you have done. maybe i just need to build my own laptop. bought this one due to light weight, thin body, etc. really tired of the windows/mac BS tried to like some dedicated linux machines (system76) but didn’t have the small size/lightweight. i’m feeling pretty comfortable ditching windows…

        1. Then just wipe whatever OS that came with your current box and install any Linux distribution that works for you. Been using Linux exclusively for 15 years. No regrets.

          1. wiped windows and been on Ubuntu ever since and not looking back. used it the last 2 years or so, starting to experiment with others too.

      1. You told me to zap the partition, but will it actually delete the data on my hard disk? I don’t have a backup, so just wanted to know this.!
        Thanks a lot.

        1. If you following the procedure described in the article, you will be zapping the GPT data structure, not the actual partition or data in the partition.

          Regardless, it is always a good idea whenever you are attempting something like this.

    1. Your screen shot does not show the options that comes after that warning. Post another one showing those options. There should be an option to destroy the invalid GPT data structures, which is the one to select.

      But post the screen shot show I can be sure.

        1. Well, it only detect a valid MBR partition on the system, so the commands you can run pertain to just that partitioning scheme.

          But let’s get back to the beginning. What issues were you having before you embarked on it, and could you provide some info on your hardware?

          1. Well, it’s like, I was trying to install Ubuntu on my Windows 8 laptop(64-bit Non-UEFI) and I have tried it earlier also, where when I booted through the USB and then when I went through the install Ubuntu, it gave me a choice that “Install Ubuntu alongside Windows 8” but now, it’s not showing up maybe because I shifted from 32-bit Windows 8 to a 64 bit one.
            My Specs:
            2 GB Ram
            2.0 GHz Intel Pentium B940
            500 GB Hard disk
            It’s a laptop so I don’t know much. Hope you can help me as Ubuntu and Windows 8 both are me necessity.
            thanks a lot.

          2. Life will be so much better without Windows 8, but that’s a separate discussion.

            Ok, if the laptop is OEM, have you checked the Secure Boot settings. Also, if it is OEM and it came with Windows 8, it should be using the 64-bit version and the GPT partitioning scheme.

            So switching it to non-UEFI mode before installing Ubuntu will not change all that, which I think is the reason you are seeing a message about invalid GPT data structures even though the output is only showing MBR data structures.

            Check the settings, switch back to UEFI and try zapping ZPT to see if it will actually show valid GPT data structures.

  6. I really like the way the terminal windows were captured.
    Could you please describe the process?

    Your terminal window screenshots are very easy to read and
    the background color looks really good too. Slightly brown or purple.

  7. Would seem to be a bug in Ubiquity. If multiple partition tables exist, obviously the non-empty one should be used by default. If multiple partition tables are used, (is this even possible?) then there is a real problem and asking would seem to be required.

Leave a Reply to finid Cancel reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
4. Axo Finans.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.


The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.