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

Zemanta Related Posts Thumbnail

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:  Epidemic 3.1 installation guide

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:  Guest session and user management on Linux Mint 11

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:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Newsletter: Subscribe for updates

Subscribe
Notify of
guest
35 Comments
Inline Feedbacks
View all comments
linuxnoob7
linuxnoob7
7 years ago

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
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
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 🙂

linuxnoob7
linuxnoob7
Reply to  finid
7 years ago

1. It came pre-installed on the PC

2. How do I check if it is install on MBR or GPT?

3. ^

linuxnoob7
linuxnoob7
Reply to  finid
7 years ago

I posted on the forum

Finiderire
Finiderire
7 years ago

Good post.

Brendan
Brendan
7 years ago

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?

Meldo
Meldo
Reply to  finid
7 years ago

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 ?

Meldo
Meldo
Reply to  finid
7 years ago

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 !

Marzounette
Marzounette
7 years ago

You save my life dude, seriously!!! Thx!!

Michel
Michel
7 years ago

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 ??

jeffrey
jeffrey
7 years ago

wow its works.. thanks

Umesh Wakalekar
Umesh Wakalekar
7 years ago

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… http://www.rodsbooks.com/gdisk/download.html
& 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 !!

nerdcom
nerdcom
8 years ago

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??!!??!

nerdcom
nerdcom
Reply to  finid
8 years ago

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…

nerdcom
nerdcom
Reply to  finid
8 years ago

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.

Vaibhav Bhasin
Vaibhav Bhasin
8 years ago

Hey, you didn’t replied to my problem ?!

Vaibhav Bhasin
Vaibhav Bhasin
Reply to  finid
8 years ago

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.

Vaibhav Bhasin
Vaibhav Bhasin
Reply to  finid
8 years ago

Ok dude. Thanks a lot..!!

Vaibhav Bhasin
Vaibhav Bhasin
8 years ago

Hello,
I tried the instructions that you gave and I got the following error. Could you please explain me what I should do as I am a kind of noob in all these partitions and all.
comment image
Please do reply.

Vaibhav Bhasin
Vaibhav Bhasin
Reply to  finid
8 years ago

After that, it showed:
Command (? for help)

Same as in your screenshot in tutorial.
Thank You.

Vaibhav Bhasin
Vaibhav Bhasin
Reply to  finid
8 years ago

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.

patrick
patrick
8 years ago

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.

wb greene
wb greene
8 years ago

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.

Get the latest

On social media

Security distros

Hacker
Linux distros for hacking and pentesting

Crypto mining OS

Bitcoin
Distros for mining bitcoin and other cryptocurrencies

Crypto hardware

MSI GeForce GTX 1070
Installing Nvidia GTX 1070 GPU drivers on Ubuntu

Disk guide

LVM
Beginner's guide to disks & disk partitions in Linux

Bash guide

Bash shell terminal
How to set the PATH variable in Bash
Categories
Archives
35
0
Hya, what do you think? Please comment.x
()
x
Algorithm 2020

Did you get your ticket yet?

Algorithm 2022 is a 3-day conference on blockchain, cryptocurrencies and AI set for Feb. 10 – 12, 2022, in Dallas. Speakers from the US Air Force, Ministry of Digital Transformation, Ukraine, and more. click that button to learn more and get your ticket. Use BSD20 code for 20% off ticket price.