If you're coming here from Google searching for how to convert a GPT disk layout to MS-DOS/MBR and don't want to read through my (probably boring) story, click here ;)
Adventures with Hybrid EFI
My gaming PC has been long overdue due for a reformat. I naively allocated only 30GB to the Windows partition (and the other 120GB to 3 flavours of Linux) thinking I wouldn't use Windows for much other than Starcraft 2, but a few months back I had the urge to play Battlefield 2 again. Ever since installing and fully patching it disk space has been running pretty tight. I had to disable sleep, hibernation as well as system restore and still only had 4GB of free space, so my filesystem became fragmented easily. With the release of Windows 8 Customer Preview (download it free here), I figured it was a good time to reformat my disk and reinstall all my OSs from scratch.
I figured while I'm at it, I would make all of the big changes at once and enabled EFI booting on my Gigabyte GA-Z68A-D3H board. Little did I know that when the BIOS says "EFI," it really means Gigabyte's "Hybrid EFI" implementation and not UEFI (although in retrospect, the fact that I made the change in the BIOS should have been enough of a hint, right?). With Hybrid EFI enabled, Windows 7 and Windows 8CP installed perfectly and even created a nice GPT disk layout so reinstalled my games and activated Windows 7. Then I rebooted to play around in Windows 8CP for a bit (I do not like it, btw).
I then tried installing Fedora 16. To my surprise EFI booting failed every time, despite the all of the Fedora 16 installation media being EFI-capable. When attempting to boot from my Fedora 16 Live (x86_64) USB key I just would get a black screen with "........." printed one dot a time and then it would proceed to fall back to the next boot device (Windows boot manager on the hard disk). Upon re-examining my BIOS settings, I was disappointed to find that the setting was actually called "CD/DVD EFI Boot Option" indicating that perhaps USB EFI booting was not supported. Fair enough, I burnt the same F16 image I was using on the USB key to a CD and tried again. The same "........." text appeared.
It was then as I went back to boot Windows 7 that I discovered my attempts to set it as the default OS from Windows 8CP removed my capability of booting Windows 7 somehow. At this point it was 2AM and I was fed up with this stupid Hybrid EFI. I looked for a way to revert to a good old MS-DOS/MBR partition layout. After some Googling I stumbled across Rod Smith's website. He has extensive documentation on EFI booting, including with Gigabyte's implementation of Hybrid EFI. He says that it shares a large amount of code with EFI DUET (tianocore) and although it does work natively with Windows 7, it is not a full UEFI implementation. That would explain the problems I was having with Fedora, then.
The actual GPT to MBR conversion
Through the Rod Smith's guidance and a few dirty tricks, I was successfully able to convert my GPT partition - without data loss or deleting any partitions - and then boot Windows 7 in legacy/MBR mode. In order to do this you'll need your Windows installation media at hand as well as a copy of the Fedora 16 Live media. If you don't have a copy of Fedora 16 Live handy, you can download the Live media ISO (64-bit) from a local mirror here. See the Fedora 16 Installation Guide for details on burning this image to a CD or on creating a bootable USB key.
Keep in mind that at this point I only had 3 partitions and a bunch of unpartitioned space on the disk, so conversion was a rather straightforward process (all GPT partitions mapped directly to primary partitions). Although it is theoretically possible to convert GPT partitions with >4 partitions by defining which ones are to be logical partitions after conversion, I have not tested this.
- Boot your Fedora 16 Live media and wait for your session to start. If you're having troubles booting, press Tab at the boot loader screen and try booting with the
nomodesetparameter added. - Depending on your graphics card, you'll either be presented with the new Gnome 3 Shell or with the traditional interface. Start a terminal session by putting your mouse in the top right corner of the screen and typing "terminal" in the search (Gnome Shell) or by selecting Applications > System Tools > Terminal (traditional interface)
- Install gdisk:This may take a few moments.
su -
yum -y install gdisk - Make a backup of your current GPT scheme:
gdisk -b sda-preconvert.gpt /dev/sda - Now we will attempt to convert your GPT disk layout to MS-DOS/MBR. Start gdisk:
gdisk /dev/sda
You should be prompted with:Command (? for help): - Press
rto start recovery/transformation. - Press
gto convert GPT to MBR. - Press
pto preview the converted MBR partition table. - Make any modification necessary to the partition layout. See Rod Smith's Converting to or from GPT page for more details on this.
- When you're happy with the MS-DOS/MBR layout, press
wto write changes to the disk. - Shutdown Fedora 16 and boot from the Windows 7 installation media
- Enter your language & keyboard layout and then select the option to repair your computer in the bottom left corner.
- From the available options, select Startup Repair. Windows will ask for a reboot.
- Follow the previous three steps again to boot the Windows 7 installation and run startup repair
- Once again, boot the Windows 7 installation media but this time opt to open a command prompt instead of choosing startup repair. Type:
bootrec /scanos
bootrec /rebuildbcd
bootrec /fixmbr
bootrec /fixboot - Close the command prompt and run Startup Repair one last time.
That's it! You should now have a bootable installation of Windows 7 on a MBR partition layout.
References
- Rod Smith's Gigabyte's Hybrid EFI
- Rod Smith's Converting to or from GPT
- Rod Smith's Repairing GPT disks
- Microsoft KB927392: How to use the Bootrec.exe tool in the Windows Recovery Environment to troubleshoot and repair startup issues in Windows
Comments
Submitted by Armando Montanez on Tue, 06/05/2012 - 17:38 Permalink
THANK YOU SO MUCH!!!!
worked like a charm!
Steps I used:
I used ubuntu 10.4 live cd and apt-get instead of yum. I noticed there was a typo with 'sgdisk' for the first gdisk command, should be 'gdisk'. For Ubuntu, you must use sudo before all "gdisk" commands. There is a newer version of gdisk out, apparently, so the questions asked is a little different. When it asked for a hex key after I typed 'g', I just hit enter to let it use the default. From there it was simply saying yes to the following questions. The only thing that scared me was that after I ran gdisk I opened gparted to see that my partition was marked as unallocated. O_O having confidence, I just ignored it and booted into win7 install disk and hit startup repair (before this I couldn't even access startup repair... it said I had the wrong version of windows!). It took a LONG time to do repairs, but once it finished I rebooted into the w7 install disk again and hit startup repair, where I was prompted to continue repairing startup. I clicked cancel, and did the cmd prompt commands instead. Worked perfectly!
THANK YOU SOOOOOOOOOO MUCH!!! I was about ready to wipe my hdd and do a clean install!
Submitted by firewing1 on Thu, 06/07/2012 - 11:07 Permalink
:)
Glad to hear it worked! Thank you for pointing out the typo, I have updated the main post.
Submitted by Brian B on Mon, 10/15/2012 - 12:18 Permalink
Must have live network
Thanks for these instructions. I'm working through them now. My first trip was step 3 as I didn't have a live Internet connection and yum install needs that connection. I would suggest that this be mentioned.
Submitted by Frank on Fri, 11/09/2012 - 16:27 Permalink
Fedora 17
gdisk is included in Fedora (starting with 16?), so no download would be needed if you use a newer version of Fedora.
Submitted by Mark on Sat, 12/15/2012 - 06:20 Permalink
Thanks
This is great stuff, worked for me prepping for a Cache SSD that only supports MBR.
i note that i did not have to run the extra commands and Windows 7 booted fine, should i be worried or will it be cool?
Thanks again, great guide!
Submitted by Anonymous on Mon, 12/24/2012 - 17:34 Permalink
Hello,
Hello,
I have Parted Magic live USB. It has gdisk but it does not have yum. Can I just run the gdisk command without runing the yum command? If not, then I have to download the ~600 MB Fedora ISO file ...
Thanks!
Submitted by firewing1 on Tue, 01/08/2013 - 12:41 Permalink
Yes
I haven't tested this, but if partition magic has the required utilities already then there should be no need to grab them with a package manager like yum.
Submitted by Mick on Sat, 01/05/2013 - 12:35 Permalink
Thank you!
Thank you!
Submitted by original_don on Mon, 01/21/2013 - 09:01 Permalink
Thanks for saving my files!!!!
Be sure to select your windows partion as bootable and as primary in step 9. steps 14-16 were not necessary for me. Thanks again man.
Submitted by Anonymous on Wed, 02/20/2013 - 10:10 Permalink
Thanks, worked great on
Thanks, worked great on Windows 8 as well (only one Repair session was needed).
Submitted by Anonymous on Sun, 03/24/2013 - 21:22 Permalink
Got this to work on Win8 too.
Got this to work on Win8 too. :)
Conversion went fine, i used Linux Mint because fedora couln't find my mobile broadband device for downloading gdisk..
Had serious problems with the bootloader repair though but finally got my os to boot properly.
Thanks a lot for these great instructions!
Submitted by meh on Fri, 04/12/2013 - 14:50 Permalink
Didn't work for me, though I
Didn't work for me, though I accidentally did only one startup repair before doing the bootrec commands. Did the correct series of two repairs, bootrecs, and one repair afterwards, but it didn't work, though at one point I got a menu asking whether to boot windows in safe mode, etc, or normally. Was very excited and chose normally, but it just put me in the windows cd setup menu :/. Also, the backup command you give is useless, because it saves the backup in a directory on livecd OS, which is wiped out when the computer is restarted... It's not a disaster because I'm doing this on a cloned disk because I expected something like this to happen.
Submitted by meh on Fri, 04/12/2013 - 14:59 Permalink
To clarify, by "didn't work",
To clarify, by "didn't work", I mean I ended up in an endless sequence of startup repairs, with windows itself never booting.
Submitted by meh on Fri, 04/12/2013 - 15:46 Permalink
Problem solved. I googled a
Problem solved. I googled a bit for the "Element not found" error that I was getting for the bootrec commands, and found remedies that really repaired the startup. I now have my win7 on an MBR disk :).
Submitted by firewing1 on Wed, 04/24/2013 - 15:57 Permalink
Great!
Glad to hear it! Feel free to post the command here if you still have it handy for others with the same problem.
Cheers,
Stewart