2012 Illinois Technology Association - CityLights Finalist

BLOGS

MPS Partners provides functional and technical expertise and insights into business process management trends and Microsoft technologies.

Contact Us
HOT JOBS
Interested in reviewing our current job openings or submitting a resume?
CLICK HERE
Home » Blog » Microsoft » How to convert Windows 7 on MBR/BIOS to GPT/UEFI

How to convert Windows 7 on MBR/BIOS to GPT/UEFI

UPDATES:

A commenter, Barton, suggests replacing step 1 through 6 with a GNU/Linux tool that converts to GPT automatically. This would save a lot of time if you’re comfortable using GNU/Linux. I would still recommend making a backup in case things go horribly wrong. I haven’t tried this yet.

  1. Boot a copy of http://partedmagic.com/
  2. Open a terminal
  3. Execute sudo parted -l to list available disks
  4. Execute sudo gdisk /dev/sda (where sda is the disk you want to convert) then press w to write the changes

Also, it has become apparent that different versions of the utilities used in this guide have surprisingly different syntax and procedures. Make sure to read through the whole guide first. When you go through the guide and something doesn’t work as expected, use the respective utilities help feature to check the syntax in your version.

Introduction

There are few reasons to switch from MBR on BIOS to GPT on UEFI, but some like adventure. Current OS and motherboard support is quite inconsistent and not well documented. If you first installed on the former and want to switch to the latter without having to lose all your data or re-install Windows, then this is your guide.

The basic idea is to backup the current install to a disk image, erase the disk, then reload the backup. Windows ships with a disk imaging tool and an image restore tool. Unfortunately the restore tool (wbadmin) requires the target partition to be at least the same size as the original backup, so we have to use another method for restore.

WARNING: You may lose all the data on your disk during this process. Make sure to back up your data!

Prerequisites

  1. A UEFI motherboard
  2. A copy of Windows 7 64bit installed to a local disk partitioned using MBR
  3. Windows install media (DVD, Hard disk, USB stick)
  4. Backup destination with enough space to hold a copy of your existing Windows install
  5. Sufficient free space on the Windows partition; the new partition will be about a gigabyte larger.

Process

  1. Backup your Windows installation and all other partitions on the physical disk to another physical disk. This backup can be done using the built-in image tool found within the control panel under “Backup and Restore” behind the “Create a system image” link. NOTE: The rest of this guide will assume just one partition to be restored.
  2. Reboot the computer to a Windows install disk.
  3. Open the command prompt
    1. press Shift + F10 at the “Install Windows” window.
  4. Repartition the disk
    1. diskpart
    2. list disk
    3. select disk x (where x is the number of the disk to convert)
    4. WARNING: This is your last chance to go back!
    5. clean
    6. convert gpt
    7. create partition ESP size=128
    8. format fs=fat32 quick
    9. assign letter=i or any other free drive letter
    10. create partition MSR size=128
    11. create partition primary
    12. format fs=ntfs label=”Windows” quick
    13. active
    14. assign letter=y or any other free drive letter
    15. exit
  5. Mount the backup VHD
    1. diskpart
    2. select vdisk file=filename.vhd where filename.vhd is your disk backup
    3. attach vdisk
    4. assign letter=z or any other free drive letter for your new partition
    5. type: exit
  6. Restore the files from the image
    1. z: (where z is the letter of your VHD)
    2. xcopy * y:\ /e /c /h /k /o /b /q /y (where d is the letter of your new partition)
      1. e = copy all subdirectories even if they are empty
      2. c = ignore errors
      3. h = copy hidden and system files
      4. k = retain readonly flag
      5. o = copy file ownership
      6. b = copy links as links
      7. q = quiet mode (should speed things up)
      8. y = always respond with yes instead of prompting
    3. Wait for the copy to complete. Commenter Niko has an excellent point here: There may be permission errors which you can probably ignore. These are likely for special system folders like “System Volume Information”. Turn off quiet mode to be sure or if the process doesn’t work and you want to verify this isn’t the cause.
  7. Copy EFI bootloader to ESP partition
    1. i: (where z is the letter of your ESP partition)
    2. mkdir EFI
    3. cd EFI
    4. mkdir Boot
    5. mkdir Microsoft
    6. cd Microsoft
    7. mkdir Boot
    8. copy x:\Windows\Boot\EFI\bootmgfw.efi i:\EFI\Microsoft\Boot
    9. copy x:\Windows\Boot\EFI\bootmgfw.efi i:\EFI\Boot\bootx64.efi
  8. Create BCD
    1. This step varies quite a bit, depending on your system’s hardware, existing NVRAM (non-volatile memory on your motherboard), and hidden BCD stores scattered around your system’s disks and partitions.
    2. Cross your fingers and hope that this step can be done automatically
      1. bootrec /RebuildBcd
    3. If things don’t work out, you will have to resort to using bcdedit. A few notes about BCD edit: it operates on the motherboard’s NVRAM unless you specify a file. As far as I can gather, the NVRAM store doesn’t matter as my PC basically ignores any setting within and boots just fine after I’ve erased it.
      1. i:
      2. cd EFI\Microsoft\Boot
      3. bcdedit /createstore BCD
      4. bcdedit /store BCD  /create /d “Windows Boot Manager” {bootmgr}
        1. Commenter Manuel says this should be bcdedit /store BCD /create {bootmgr} /d “Windows Boot Manager” but I haven’t tested this. This may depend on the version of BCD edit you are using.
      5. bcdedit /store BCD /create /d “Windows 7” /application osloader
      6. The previous command will return a GUID, referred to later as <guid>
      7. bcdedit /store BCD /set {bootmgr} default <guid>
      8. bcdedit /store BCD /set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi 
      9. bcdedit /store BCD /set {bootmgr} locale en-us
      10. bcdedit /store BCD /set {bootmgr} displayorder {default}
      11. bcdedit /store BCD /set {bootmgr} timeout 10
      12. bcdedit /store BCD /set {default} device partition=c:
      13. bcdedit /store BCD /set {default} osdevice partition=c:
      14. bcdedit /store BCD /set {default} path \windows\system32\winload.efi
      15. bcdedit /store BCD /set {default} systemroot \windows
  9. Change your motherboard firmware to run in UEFI mode
  10. You should now be able to select your Windows disk as your startup disk.

Good luck!

More Reading

This entry was posted in Microsoft, Mobile Solutions. Bookmark the permalink.

28 Responses to How to convert Windows 7 on MBR/BIOS to GPT/UEFI

  1. XDarkMario says:

    This guide is good but i think there’s spelling typos that can lead someone to world of trouble. maybe spelling error or not but there’s no such file as bootmgfw.”edi” perhapse ment bootmgfw.efi for a second time.
    and im not sure if create partition “MSR” worked or not but MSI did

  2. Manuel Himmler says:

    Step 4 doesn’t work, it should be: bcdedit /store BCD /create {bootmgr} /d “Windows Boot Manager”

    • Charlie Hayes says:

      Thanks, I made added a note. I suspect this is a version difference as I tested the whole process on my machine before posting.

  3. Niko says:

    Yes, it’s working. just in 6, in xcopy * y:\, letter is d.

    Warning if you have error “access denied” after xcopy, don’t close cmd windows, just wait and of copy. I don’t know wich file give “access denied”, but system seem to be working properly.

    In french :
    Oui, ça marche. Juste au point 6 (xcopy): la lettre est d et non y (la lettre de la partition de destination)

    Si vous avez une message d’erreur “accès refusé” après la commande xcopy, ne pas fermer la fenêtre, laissez continuer la copie. Je ne sais pas d’ou vient l’erreur mais l’image système est bien copiée et fonctinne bien.

  4. Paul says:

    First off how do I find out what my virtual filename is when I don’t have windows to look at it? Can I mount the external usb drive in that command prompt? Also the partition creation in your part 4 didn’t work at all. I kept putting in those commands and it kept returning with commands I can use without having done anything to the drive. Overall the information provided here unfortunately wasn’t usable.

    The sad thing is I created the backup image on the same laptop that I am trying to restore it to. I just want to restore it to a new drive. It comes back when I use the gui version of the image restore from the startup disk saying that it was created on a bios drive and the computer is efi. I don’t know why it is doing that and right now I am having to just install from scratch and hopefully restore that way. I really do hate windows.

    • Charlie Hayes says:

      You can use the ‘dir’ command to list files. It would really help to know how to use the command prompt when going through this guide. Which substep was failing while creating the partitions? What version of Windows are you using?

  5. Jason says:

    Good guide. I have a few questions for anyone who may know:

    1. Which version of Windows was used to produced this guide? We are using volume-licensed Windows 7 Professional x64 (English), and there seem to be some significant differences in terms of commands used.

    2. Has anyone tested a system nearly every day for a few months just to see if any problems occur? If we actually put this in production, we would need the system to continue being rock-solid, since we are an IT department for a company.

    Right now, we make most of our images using MBR. However, more and more devices are coming with UEFI/GPT, and the Microsoft Surface tablets absolutely, positively *require* UEFI/GPT — there are no firmware options to change to MBR. Also, it is becoming more of a pain even on Dell’s OptiPlex and Latitude lines to change the firmware from UEFI to BIOS/legacy. When we need to image 30 new machines, we have to turn on each one, turn on the legacy firmware, disable secure boot, and turn on MBR just to get it to work with our images.

    So, here is our dilemma: do we start keeping two sets of images: one for MBR and one for GPT? I really don’t want to do that. Right now, we have about 7 images that we actively need to maintain; maintaining a separate GPT image for most of our MBR images might increase the images we need to maintain to about 12 or so, and it would be more thing that we have to keep up with it. That’s a shame to have to do for images that are basically identical, aside from their partition style.

    However, if the above guide works and the resulting GPT image is solid, we could — in theory — simple crank out a converted GPT image each time we make changes to the MBR images. That would significantly cut down on our maintenance times.

    The problem I described may not be an issue in many environments, but we have many older (circa 2007) and many newer (2013 and newer) machines that we need to support, so the firmware that we have to support is diverse. In the future, we may no longer need to support MBR, but I can see needing to support it at least 5 more years — and if history is any indication, it might be closer to 10 years.

    • Charlie Hayes says:

      I put together the original guide using Windows 7 Pro and then tested it from as scratch as I could get it using Windows 7 Pro again. I would love to hear about what discrepancies you are finding. If they are command line arguments for various steps, I would guess the versions you are using have similar arguments. Use /? to get help on the arguments for your versions.

      My Windows 7 machine has been running this way for a couple of years now, but it’s not my primary machine.

      Depending on how you handle your images, I suspect you might be able to have a partition scheme image and partition image for the actual data.

      The EFI/GPT situation is pretty bad. Adoption is slow and inconsistent, the tools are lacking, and information is sparse. OSes and boot loaders aren’t very robust and I feel that the only problem GPT manages to fix is larger disks/numbers of partitions and then introduces a whole lot of additional problems and mysteries.

      Good luck!

  6. Jason says:

    Charlie, I agree. Right now, we are in a difficult situation because we can’t simply trash perfectly good computers that just so happen not to use GPT/EFI, but we have to support the newer machines, as well. MBR is the most ubiquitous, so that’s what were primarily use, but newer machines from Dell are making it clear that MBR will be gone in the next few revisions, since you already have to set like three settings to make MBR work natively in their OptiPlex and Latitude lines. God help us when we get numerous machines without MBR support.

    What do you mean by “partition scheme image?” That sounds interesting.

    In regards to the command-line differences, there were indeed arguments that were different. They were so similar, though, that I actually thought that you must have made a typo in the guide — shows what I know!

    • Charlie Hayes says:

      You could make a disk image containing the partition scheme and another image for just the volume/partition containing the data/files/OS.

  7. ankit says:

    thanks man very helpful for me as a non programmer… thanks again

  8. Barton says:

    There are many awesome tricks to be gleaned from steps 7 & 8. I was able to restore my Windows 7 system after conversion to GPT/UEFI using only step 7.

    Steps 1-6 may be eliminated by simply booting from a Linux CD like PartitionMagic, opening a terminal and executing the command similar to
    > gdisk /dev/sda
    w
    Partition layout and UUID will be preserved and there will be no data loss.

  9. Jason says:

    Another question for anyone who knows: has anyone tried this using Windows 8.1 yet? That (or Windows 9) seems like we are ultimately going to be using UEFI/GPT the most.

    I would think that if it works for Windows 7, it should work for Windows 8.1 — but who knows until it is tested.

    Another question not related to the above question: does Windows correctly report that it is on a GPT disk if it has been converted from MBR? Just curious if that designation is incorrectly carried over or not.

  10. Jason says:

    I gotcha. But I am just wondering if Windows “hard-coded” what it reports as its disk-system type in the Disk Management console or if Windows can dynamically change what it reports depending on what type of disk it is on at the moment that the Disk Management console is run.

  11. Lance says:

    create partition ESP ? ESP is not a valid option. Did you mean EFI?

  12. Faris says:

    in step 4 number 8 the command prompt say “there is no volume selected. please select volume and try again”

    • Charlie Hayes says:

      In the version of diskpart I used it selected the newly created partition automatically (step 4.7). You might need to explicitly select it in your version. Use ‘list volume’, then ‘select volume x’.

  13. Rich says:

    Awesome guide, however steps 12 and 13 say they’re not supported operations. I ignored this and continued on regardless and when I tried to boot got
    “Windows failed to start. A recent hardware or software change might be the cause…
    File: \EFI\Microsoft\Boot\BCD
    Status: 0xc000000d
    Info: An error occurred while attempting to read the boot configuration data.

    I guess it’s down to steps 12+13 but I cannot get them to work, any clues?

    • Charlie Hayes says:

      The system may have given your Windows drive a different letter than C, otherwise I’m not sure what went wrong.

  14. Chris says:

    Great page Charlie, thank you.

    Please can you help with a query.
    I have a single SSD with C,D & E.
    OS on C: other stuff on D & E.

    To convert from biosto efi would I need to make another partition in addition ?

    Thanks again.
    Chris

    • Charlie Hayes says:

      You may be able to use the newly-published GNU/Linux method to forgo the need to use a second disk, but I recommend making a backup to another disk or a network location before you do anything.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

 
View By Author
  • View By Category
View By Date
Part Of SPR COMPANIES
© 2014 SPR Companies. All rights reserved. About | Capabilities | Products | Solutions | Clients | Events & Resources | Careers | Site Map | Legal/Privacy