Converting windows (bootloader) from mbr to gpt/uefi

27
2013-10
  • varesa

    I have windows 7 installed on a laptop on a small 160 Gb hard drive that has the MBR partition table. Now I would like to move it to a bigger disk, format it with GPT and multi-boot linux (Fedora).

    My first test was to just dd the smaller disk's contents to the bigger one, and it worked (I could enlarge the windows partition & etc.).

    Now I'd like to change the MBR to GPT (to not to be constrained by the 4 (prim.) partition limit, and because the Fedora 18 I am trying to install does not seem to like MBR (the wizard does not recognize free MBR space, but says that the disk is full. I could partition it manually though, but I'd like to get it to work with GPT)).

    There are two possible issues I might bump to:

    • Windows 7 GPT booting support requires EFI (according to some sources, not according to others). How do I know if my laptop supports EFI? The laptop is a Fujitsu-Siemens Lifebook S series S751. I tried googling "lifebook S751 efi", but I could not really find anyting the way or another. Will this give me trouble? [UPDATE]From playing around my with my linux installation on the laptop, I think I can conclude that it supports EFI.[/UPDATE]

    • The original installation had the main system (C:) partition on a second logical partition inside an extended partition. If I move it to GPT-partition xyz, I assume that the windows bootloader will break? Is it possible to easily fix it?
      I Tried googling for "windows system mbr to gpt", but all I could find was people wanting to convert the other way (back to mbr)...

    [UPDATE]

    • From this "project" I've learned at least that EFI booting requires different kind of bootloader. I managed to find the EFI files for windows from a) install.wim on an install disk b) "c-drive"/Windows/Boot/EFI/. However if I try to boot these efi files either by using grub2 of my fedora installation on the same disk, or using efibootmgr to add an entry to the "efi bios" (or whatever it is called), it just goes back to the boot screen.

    So the issue that remains is how to modify/fix/recreate the windows bootloader?

    [/UPDATE]

    The reason I am asking for this instead of trying out is that it takes really long times to copy/move/resize a 150Gb partitions. After the 15th time I am loading up the live cd, and moving things around and waiting, I am starting to think that I'd like it to go well...

    So if anybody has experience about a similar transfer, I'd kindly appreciate any things I should consider.

  • Answers
  • Rod Smith

    Unless your new disk is over 2TiB, I strongly advise against attempting an MBR-to-GPT conversion on a Windows boot disk. The reason is that Windows ties its boot method (BIOS vs. EFI) to the disk type, so doing such a conversion requires switching from a BIOS-mode boot to an EFI-mode boot of Windows. If you're sure your firmware supports EFI, then this is at least possible, but it's still a hassle. See this page for details of how to do it. Basically, you need to use gdisk to do an MBR-to-GPT conversion, create a new EFI System Partition (ESP) to hold the EFI boot loader, and set up the EFI boot loader. You'll need to make similar changes in Linux, too, but they can be done a little more easily.


  • Related Question

    windows 7 - More than 4 primary partitions on MacBook with rEFIt (GPT/MBR syncing)?
  • fideli

    I currently have a triple-boot on my MacBook (OS X 10.6.5, Windows 7, Ubuntu 10.10) which works very well. I'd like to now make an ExFAT storage partition that would be shared amongst the three OS's, with the importance on sharing between Windows and OS X. This is what it looks like right now:

    $ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.1 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS MacOSX                  400.0 GB   disk0s2
       3:       Microsoft Basic Data BOOTCAMP                74.5 GB    disk0s3
       4:       Microsoft Basic Data                         25.3 GB    disk0s4
    

    There are, it appears, 4 partitions on the drive already, since the EFI requires 200 MB in the beginning. I'm wondering if I were to add another partition whether that would mess up the GPT/MBR syncing that rEFIt does for me because there would be more than 4 primary partitions on the disk. I will likely use iPartition for this.

    EDIT
    To add to the complexity, for unrelated reasons I decided to switch from Ubuntu to Fedora on that last partition. During the install, my curiosity made me select the recommended two partition setup with /boot going on a 500 MB /dev/sda4 and / in an LVM on /dev/sda5. The drive now looks like this:

    $ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.1 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS MacOSX                  400.0 GB   disk0s2
       3:       Microsoft Basic Data BOOTCAMP                74.5 GB    disk0s3
       4:                        EFI                         524.3 MB   disk0s4
       5:                  Linux LVM                         24.8 GB    disk0s5
    

    When I re-synced rEFIt, it suggested an MBR table that only had the first 4 partitions on it. Will try to get that info to add to this next time I reboot.

    EDIT
    Turns out that that you can't have more than 4 primary partitions with the GPT/MBR sync. In retrospect, it all makes sense now. I decided to just go ahead and test this so I created a 25 GB partition on the end of the drive. Looks like this now:

    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.1 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS MacOSX                  373.4 GB   disk0s2
       3:       Microsoft Basic Data BOOTCAMP                74.5 GB    disk0s3
       4:                        EFI                         524.3 MB   disk0s4
       5:                  Linux LVM                         24.8 GB    disk0s5
       6:       Microsoft Basic Data Transfer                26.6 GB    disk0s6
    

    Used OS X to format the last partition as exFAT (volume name Transfer). Used rEFIt to sync the GPT and MBR tables. Only showed up to 4 (which answers this question), which doesn't show up in Windows (which was expected). Next, I downloaded an OS X binary of the gptsync.efi program that rEFIt uses from the InsanelyMac forums and ran the following command to select the GPT partitions I wanted in the MBR table (1, 2, 3, and 6):

    sudo gptsync /dev/disk0 2+af 3-07 6-07
    

    thinking that the MBR type is 07 as listed on the exFAT WikiPedia page. When I rebooted into Windows again, the partition showed up in diskmgmt.msc, but as a RAW format. Upon accessing it in Explorer, I get the option to format it. I decided to try using a different MBR code and ran the following command again in OS X:

    sudo gptsync /dev/disk0 2+af 3-07 6-0c
    

    which did not resolve the problem. A cursory search suggests that exFAT is only meant to be used on external volumes, and that Windows would not load an internal partition formatted as exFAT. So, two things: (1) I either still have the MBR code wrong or (2) it just won't be read by Windows.


  • Related Answers
  • Everett

    I did exactly this (Win7 64, Ubuntu 10 64bit, OS X 64 bit, and an ExFAT part). When I found out that Customs could search a laptop at will without a court order in violation of the Constitution, I chose to move the ExFAT to a 128GB ExpressCard SSD (100 GB ExFAT set up for user space, 8 for each OS swap file, and the leftover space as RAM for Win7 to use).

    This way all three systems could use the ExFAT as user space, it wasn't physically on the computer (it's removable), and since I was using 2 drives (one for OS/Apps, the other for user space/swap space) I sped up my system (not a huge amount).

    If I had to worry about anyone wanting to see what was on my computer, I simply removed the user/swap space. I have licenses for all the Apps and the OS's on my Apps/OS drive. There are no applications that are unlawful for me to own/use to the best of my knowledge. I use Launchbar to search my user space (because the database for it is kept on the user space not on the OS/App space like Spotlight). I just wanted to give you food for thought.