How to Convert a GPT disk layout to a MS-DOS/MBR layout without data loss (and Gigabyte Hybrid EFI)

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.

  1. 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 nomodeset parameter added.
  2. 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)
  3. Install gdisk:
    su -
    yum -y install gdisk
    This may take a few moments.
  4. Make a backup of your current GPT scheme:
    gdisk -b sda-preconvert.gpt /dev/sda
  5. 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):
  6. Press r to start recovery/transformation.
  7. Press g to convert GPT to MBR.
  8. Press p to preview the converted MBR partition table.
  9. Make any modification necessary to the partition layout. See Rod Smith's Converting to or from GPT page for more details on this.
  10. When you're happy with the MS-DOS/MBR layout, press w to write changes to the disk.
  11. Shutdown Fedora 16 and boot from the Windows 7 installation media
  12. Enter your language & keyboard layout and then select the option to repair your computer in the bottom left corner.
  13. From the available options, select Startup Repair. Windows will ask for a reboot.
  14. Follow the previous three steps again to boot the Windows 7 installation and run startup repair
  15. 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
  16. 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.



File Fragmentation

The 500GB SATA drive in an external enclosure that I use for backups (eSATA/USB 2.0 connectivity) is currently NTFS-formatted for compatibility reasons. I would much prefer to use ext3 or HFS+, but it's pretty hard to get those two working correctly on all operating systems. Thanks to NTFS-3G and (Mac)Fuse, I can reliably access NTFS partitions on Linux, OS X and Windows (of course) so it's become my FS of choice when it comes to compatibility.

Unfortunately, that means that the drive becomes horribly fragmented (and pretty quickly, too). I decided to do a defrag today and found that the NTFS partition was 38% fragmented with 78% file fragmentation... Yuck. I'm going to be really happy when there's a filesystem that I can use on all operating systems that doesn't fragment or choke all the time. Ext2/3 was looking like a pretty good for the "doesn't fragment" part, but the ext2fsx project for OS X seems to have died out and ext2fsd, the only driver I've found for Windows that supports ext3 filesystems with inode sizes > 128, tends to bluescreen a lot. Back to waiting, I guess...


Realtek HD + Mic (aka Intel Integrated Audio on ICH8)

I bought a low-end Logitech headset recently and it works perfectly in Linux but for some reason in Windows the volume was terrible. To make matters worse, it seemed like the drivers don't support mic boost and only the main "capture" slider is changable… The others such as line-in are locked!

After a bit of Googleing I came to relatively simple fix to the problem. If you're looking for a way to bring up your mic's volume, follow these steps:

  1. Update to the lastest drivers available from the Realtek website.
  2. Browse to C:\Program Files\Realtek\Audio\InstallShield and run the program named MicCal.exe
  3. Follow the on-screen instructions and when promted with a slider, bring it down to zero, leave it there for a few seconds. Raise it to 100% and be sure to click Next right away. Continue with the on-screen instructions to finish the wizard.
  4. Open up Realtek HD Sound Effect Manager from the Sounds, Speech & Audio Devices control panel category. You'll notice under the Playback knob on the left, you have a litte wrench/tool icon; click it and make sure Rear Pink In is checked off.
  5. Now, (use the arrows as needed) click the small button labeled .. (the Advanced button) under Rear Pink In. There, hidden, are the options for Mic Boost!

Reference: johnnygoodface's post at techspot forums


Favourite Freeware Apps for Windows

Well, as usual, it's been a while... I'll start by saying happy new year! Better late than never I guess ;)

Anyways, ever since I started developing fwbackups for Windows I've had to use it a lot more often than I used to. Here's a list of some (free) Windows apps I've found to be very useful:

  • iTunes: As much trouble as I've had in the past with Apple products, I've yet to see a better media player that's as easy to use, configure and has equivalent features. The only thing I wish is that I could import with lame directly from iTunes.
    • iTunes Lyrics Importer searches for song lyrics and automatically updates your iTunes library
    • iTunes Library Updater (iTLU) makes it a breeze to manage your library when it comes to updating track info, adding new songs or removing the dead links in your library.
  • Notepad++: One of the best text editors I've seen when it comes to programming or just general-purpose text. Of course, nothing beats good old GEdit though ;)
  • MediaCoder is a free audio and video transcoder. It supports almost any format you can imagine, has a nice interface, huge amount of features, and even some presets for various devices like the PSP or iPod.
  • WinSCP for all your secure file copying needs.
  • PuTTY for all your SSH needs.
  • 7-zip: Finally, open bz2 archives and a whole lot more without any annoying "trial" and "upgrade now" messages!

All these programs are free to download & use, and most are open source. Enjoy!



DBA: Drivers before Activation.

I'll have to remember that next time I install XP, as after installing the Intel and JMicron RAID/SATA controller drivers Windows thought I had "major hardware changes" and required me to reactivate my machine... At which point it said I had reached the maximum number of activations (which really was only one, half an hour before, to be precise) so I had to call Microsoft to get that sorted out.

I wish I could opt out of all this genuine activation.