Converting Win7 from MBR to GPT, Part 2

This is the second part of a 2-part series on converting Windows 7 from MBR to GPT.  Here we delve into the actual conversion process.  This is not for the faint of heart; be sure you have an adequate backup.  It helps if you are comfortable using the command line and changing BIOS/UEFI settings.

Basically, the process involves converting the partition table to GPT, creating a UEFI System partition, and populating that partition with the appropriate files.

  1. Copy Windows Boot Files
  2. Boot into Linux (Parted Magic).
  3. Use gdisk to convert the HD from MBR to GPT.
  4. Use GParted to create a UEFI System partition.
  5. Set up the UEFI System partition.
  6. Use the Windows 7 install CD to repair the boot process.


Copy Windows Boot Files

Copy the windows boot files onto a USB thumb drive. After the disk is converted to GPT, these files will be placed in the EFI partition.

Show hidden files.

  1. Open an explorer window and press “Alt” to bring up the menu.
  2. Go to: Tools –> Folder Options
  3. Select the View tab.
  4. Select “Show hidden files, folders, and drives”.

Show Hidden Files

The windows boot files are available in 2 places: on the hard drive, and on the install DVD. Don’t worry if you weren’t given a Window 7 install DVD with your computer; a friend’s DVD will work just as well. In any case you’ll need a Windows 7 64-bit install DVD later.


  1. Brows to C:\Window\Boot\
  2. Copy the “EFI” folder to your thumb drive.


  1. Browse to [Win7 x64 DVD]\sources\
  2. Use 7-Zip to view the contents of “install.wim”.
  3. Browse to [install.wim]\1\Windows\Boot\
  4. Copy the “EFI” folder to your thumb drive.

I ran into problems with the boot files from my hard disk.  The Window 7 DVD I had was not the one that had been used to install Windows on my computer.  Using the boot files from the DVD solved those problems.


Boot into Linux

I used Parted Magic to convert my disk. You can get the latest version at

  1. Download the x86_64 image of Parted Magic (I downloaded pmagic_2012_2_19_x86_64.iso).
  2. Burn the image to a CD (ImgBurn is a good tool).
  3. Boot from the Parted Magic CD.
    1. Insert the Parted Magic CD and reboot.
    2. Press ESC to enter the Startup Menu.
    3. Select “Boot Menu”.
    4. Choose ATAPI CD/DVD Drive.
    5. At the boot selection screen, highlight option 1 and press TAB to edit it.
    6. add “nomodeset” to the end of the list of boot arguments.
    7. Press “Enter” to boot.

Why set “nomodeset”? Because the HP Omni All-in-One doesn’t have an external monitor, linux has a hard time detecting what mode to use for the display. This option fixes the problem of a blank or garbled screen.


Convert from MBR to GPT

gdisk is a command-line tool that will convert your MBR disk to GPT without changing the partitions.  For a walkthrough on using gdisk:

Open a terminal and enter the following command:

# gdisk /dev/sda

This will open gdisk on the primary hard disk (the secondary hard disk would be /dev/sdb). To convert the disk to GPT, type “w” and press Enter.

# gdisk /dev/sda
GPT fdisk (gdisk) version 0.7.2

Partition table scan:
     MBR: MBR only
     BSD: not present
     APM: not present
     GPT: not present

Found invalid GPT and valid MBR; converting MBR to GPT format.
you don't want to convert your MBR partitions to GPT format!

Command (? for help):w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT).
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.


Create UEFI System Partition

Now that the partition table is GPT, it is time to create some partitions.  If you plan on installing additional operating systems (e.g. linux or hackintosh) now is a good time to set up those partitions. You could use gdisk to do this or any other GPT-aware partitioning tool. I used GParted, which is a graphical tool & has an icon on the Parted Magic desktop.

The UEFI System partition should be 200MB FAT32. Unfortunately, I had some issues with FAT32 and the rEFInd bootloader, so my UEFI system uses FAT16.

My partitioning scheme is as follows:

No.     Name           Size     FS
1       Windows Boot   100MB    NTFS
2       Windows 7      250GB    NTFS
3       HP Recovery    12.5GB   NTFS
4       UEFI System    200MB    FAT16
5       Ubuntu         250GB    Ext4
6       Hackintosh     250GB    HFS+
7       Experimental   250GB    Ext4
8       Swap           9GB      Swap
9       Home           375GB    HFS+

After all the partitions are created, it is important to make sure that the UEFI System partition is the correct partition type and attributes.  Go back into gdisk and change the partition type to “EF00” and enable the system partition attribute.

# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): t
Partition number (1-9): 4
Current type is 'Microsoft basic data'
Hex code or GUID (L to show codes, Enter = 8300): ef00
Changed type of partition to 'EFI System'

Command (? for help): x

Expert command (? for help): a
Partition number (1-9): 4
Known attributes are:
0: system partition
1: hide from EFI
2: legacy BIOS bootable
60: read-only
62: hidden
63: do not automount

Attribute value is 0000000000000000. Set fields are:
  No fields set

Toggle which attribute field (0-63, 64 or  to exit): 0
Have enabled the 'system partition' attribute.
Attribute value is 0000000000000001. Set fields are:
0 (system partition)

Toggle which attribute field (0-63, 64 or  to exit): 

Expert command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT).
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.


Setup the UEFI System Partition

Now the UEFI System partition is ready for some data.  Mount the partition:

# mkdir /mnt/UEFI
# mount /dev/sda4 /mnt/UEFI

Mount your thumb drive (the one with the Windows 7 boot files on it).

To determine with device the thumb drive is, first type this command:

# tail -f /var/log/messages

Then plug in your thumb drive. Watch the log. You’re looking for something like this: “sdc: sdc1”. That means your thumb drive is /dev/sdc1. Press “ctrl+c” to kill the tail command. Then mount your thumb drive.

# mkdir /mnt/usb
# mount /dev/sdc1 /mnt/usb

Create this file structure on the UEFI System partition: “/EFI/Microsoft/Boot”. In other words:

# mkdir /mnt/UEFI/EFI
# mkdir /mnt/UEFI/EFI/Microsoft
# mkdir /mnt/UEFI/EFI/Microsoft/Boot

Copy the contents of the EFI subfolder from your thumb drive to the Boot folder on the UEFI System partition.

# cd /mnt/usb/Backup/Windows/Boot/EFI
# cp -R * /mnt/UEFI/EFI/Microsoft/Boot/

Unmount the filesystems and remove your thumb drive.


Repair the Windows 7 Startup Files

Reboot the computer using your Windows 7 x64 Setup disk.  You can use your friend’s disk if you want.  Just be sure it’s a 64-bit version of Windows 7; the 32-bit version doesn’t support UEFI.

Be sure to boot the disk in UEFI/GPT mode.  On the HP Omni the steps are as follows:

  1. Press “Esc” to enter the Startup Menu.
  2. Press “F9” to enter the Boot Menu.
  3. Select your DVD from the UEFI Boot Sources list.  Mine is called “UEFI: hp DVDWBD TS-LB23P”

After the disk boots, choose your language and keyboard and press “Next”.

Select “Repair your computer” and let the disk do its thing.


If you get an error message that says:

This version of System Recovery Options is not compatible with
the version of Windows you are trying to repair.  
Try using a recovery disc that is compatible with this version of Windows.

Do no fear.  Simply use the boot files from the Windows 7 Setup DVD, not from your computer.  The boot files from the DVD will be compatible with the DVD.


If everything is working properly, you will get the following message:

Windows found problems with your computer's startup options.
Do you want to apply repairs and restart the computer?

Click “Repair and restart”.

I had run through the process twice (booting from DVD & clicking “Repair and restart”) before Windows would boot correctly.

You should now see “Windows Boot Manager” as an option in your UEFI boot menu.  Select it to boot into Windows.


 All Done

That’s it! You now have a Windows 7 system that boots using UEFI from a disk with a GUID Partition Table. Congratulations!




Converting Win7 from MBR to GPT, Part 2 — 17 Comments

  1. Great guide, the only thing I would mention is that for the terminally impaired (no pun intended) the folder creation and file copying can be done with a more user friendly GUI by executing “sudo pcmanfm” when in gparted.

  2. A minor note: A directory hierarchy can be created rather faster by using the -p flag to mkdir, which will create any necessary parent directories to the one specified on the command line.

    In this case, it only saves two commands, mind.

  3. Since I don’t have an optical disk, I got stuck at last step and was unable to recover the partition after 1 entire day of trying different approaches.
    When trying to repair the disk connected externally to a pc booting the very same win 7 dvd, I finally got the impression it was going to repair the external system – but a BSOD (in RE!) cut out all hopes.

  4. Bert,

    I wish you luck in getting your disk to boot. If you do figure it out, please post the solution here so other people in your situation can find it.

  5. sdnalloh – very nice guide, it was extremely helpful. I had to change a production backup to disk appliance based on a Dell PowerEdge R410 running Windows 2008 R2 Standard edition (OEM licensed) from BIOS/MBR to UEFI/GPT so we could fully utilize our expanded disk array.

    Prior to attempting this change on our production system, I replicated our setup utilizing a virtual machine in our VMware cluster, and did a trial run there. Based on that, I’d like to point out a couple of things that I found.

    1.) Before booting Parted Magic, don’t forget to switch your BIOS to EFI – especially if you are using a virtual DVD over a ILO, DRAC or RSA to boot Parted Magic from – you don’t want to have to start the process over again and go through the slow DVD boot process again.

    2.) If you have services that depending on drive letters being present on boot (i.e. you have an SQL server database on D:), then make sure you set all the services to disabled prior to starting. You never know how your drives are going to re-lettered by Windows after changing your drive layout. In my case, my original D: drive ended up as my F: drive on my production system – fortunately, I had disabled the services that depended on the D: prior to starting all this.

    3.) It doesn’t seem to matter where the 200MB partition goes – in the test environment, I converted the drive to GPT (following your instructions), then I used the GUI partition manager in Parted Magic to re-size the 50GB NTFS boot partition to have 200MB free in the front of it, created and formatted my 200MB UEFI boot partition, and then when back to following your instructions. In our production environment, I made the 200MB at the end of the 50GB partition.

    4.) With regards to copying the EFI boot files, you were going about it the hard way (finding the correct DVD, copying the files to USB, etc). It is simpler to just mount the Windows boot drive and copy the files right from it – these **will be** the correct files for booting your Windows installation after all.

    5.) Booting from the correct Windows install DVD and running a repair is totally unnecessary and time consuming. All you need to do is boot with a Windows install DVD that understands BCD and UEFI (so any x64 DVD for Vista, 2008, W7, W8, or 2012 – so having a DVD that matches your Windows version is not required), and when the initial language and preference screen appears, hit Shift + F10 to open a command prompt. Determine which drive letter is your Windows installation (i.e. DIR C:, DIR D: until you find the correct drive letter that has Windows), and then from X:\SOURCES, run:

    BCDBOOT {driveletter}:\WINDOWS /V (this adds the installation to the BCD)
    WPEUTIL REBOOT (this reboots the machine)

    Now your should be able to reboot into your Windows system. All told, I think it took me about 75 minutes to convert our production server (it takes approximately 8 minutes just to boot Parted Magic over the DRAC’s virtual DVD, and another 5 minutes to boot the Windows installation DVD). Of course there was check disk that Windows wanted to do on the first boot after conversion, and then I had reboot to change drive letters, followed by another reboot after I set our B2D services to automatic from disabled. And that 75 minutes didn’t include the time it took to document the system ahead of time (in case crap happened), or to download and stage the necessary DVDs, do the defrag, etc.


  6. Couldn´t do the last “Repair …” part, cause the PC doesn´t have installation disks. And Windows 7 setup freezes when loading disk.sys in uefi mode

    • My computer didn’t come with a Windows & installation disc either. I borrowed one from a friend. Alternatively, you could purchase one.

    • If there is an easier way, I would love to hear about it.

      The easiest way would probably be to do a fresh UEFI install. But that is not always an option.

  7. Everything seemed to go ok until I get to the end for the Repair with Windows 7 DVD part, it starts the Repair but then fails after 5 seconds with an error stating unable to Repair, I click on the details and I see “Corrupt windows intall” but I know it wasn’t when I started.

    I also tried the: BCDBOOT {driveletter}:\WINDOWS /V (this adds the installation to the BCD) method, but I get some sort of handle error opening or accessing.

    Also for some reason I have to have ALL the boot folders in the newly created fat32 partition (3 others, not just the EFI folder) Otherwise I get that message:

    “This version of System Recovery Options is not compatible with
    the version of Windows you are trying to repair.”

    So, just to clarify, I read this article as the only Folder needed was the EFI folder, so if that’s the case, then something is wrong?

    I also notice in the UEFI boot options it says “Windows Boot Manager (Drive not found)” listed, but the drive is there.

    Before starting, I have the drive set up as Primary partition C: for Win7, then a extended partition as D: for data, on the same drive. Should D: be a primary partition as well? would that be the problem? Do all the partitions on the drive need to be set up as Primary for this to work? and can you have more than one Partition?


    • I’m not 100% sure what the problem is, but you might want to make sure you booted the repair disk as a UEFI boot device. Also, I had to perform the repair process twice before the computer would boot into Window 7.

      What is your partition scheme?
      What is the file structure on your EFI partition?

      I have not tried the BCDBOOT procedure, so I cannot speak to that.

  8. Great post and thanks for the detail.

    There is one command that didn’t mention. Bootrec.exe
    I suggest the following link for the full detail.

    I also learnt that win7 installation on gpt disk (protective mbr and not hybrid) will need a specially prepared USB having a Fat32 EFI partition and the windows efi file in correct location. Otherwise the win7 install when selecting free space on the HD will come up error saying the volume is not compatible.
    One last thing, on my HP Probook, I have to select boot mode UEFI with CSM. As Win7 video driver require CSM.

    Thanks again Sdnalloh for sharing this great post.

  9. Hi there! This blog post couldn’t be written any better!

    Reading through this article reminds me of my previous roommate!
    He always kept preaching about this. I am going to forward this article to him.

    Pretty sure he will have a good read. Thank you for sharing!

Leave a Reply

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