Convert Windows System MBR disk to GPT with EFI without data loss

uefi-logoTutorial how to convert Windows System disk from MBR partitioning scheme to GPT (GUID Partition Table) without data loss in Windows Server 2012 R2.

This tutorial is targeted for VMWare virtual machine Windows Server 2012 R2, but it should be compatible with other Windows x64 editions (Vista/2008 and newer).

Update: (Checkout new article where Microsoft released official tool for MBR2GPT conversion)

Something about GPT before we start conversion:

  • Allows up to 128 primary partitions
  • Support for large partitions greater than 2 TB (MBR limit)
  • Better workflow and CRC partition table protection
  • Can be used as a boot volume on x64 Windows Server 2008/Vista and newer with UEFI
  • Supports all x64 platforms

This tutorial is just for my personal purposes. It was published for people which knows what they do and needs fast solution in this way. I’m not responsible for any harm or damage of your OS and HDD.

  • What we will need:
    • Installation Disc/USB/ISO of current installed Windows
    • UEFI support (WMWare has option to edit VM and switch from BIOS to EFI)
    • I assume you have supported system for booting from GPT, in this case I have Windows Server 2012 R2 with snapshot or system state backup if something goes wrong
    • Small tool named gptgen – (local mirror – gptgen-1.1)
  • Find number of system disk (usually marked as Disk 0)
cmd
diskpart
list disk
  • Download & run gptgen.exe from command line and accept warning with system disk conversion
gptgen.exe -w \\.\\physicaldrive0
  •  Restart machine and boot to mounted Windows installation disc
  • Navigate to Repair > Troubleshoot > Command prompt
  • Identify system disk (usually marked as Disk 0 – you can also recognize it with “*” inside GPT column)
diskpart
list disk
select disk 0
list partition
  • Select and delete system partition (it shoud have size of 350 MB with 1024 KB offset, in some situations it can be smaller, but not smaller than 230 MB!, then you will must resize system partition with some external tool for minimal supported partition size – 230MB)
select partition 1
delete partition
  •  Create new Microsoft reserved partition (boot partition)
create partition EFI size=100 offset=1
format quick fs=fat32 label="System"
assign letter=S
create partition msr size=128 offset=103424
  •  Now we need to assign volume letter where is installed our windows OS (it should has assigned letter in default, you can recognize it with no Label defined in default state)
list volume
select volume 2
assign letter=C
  •  Exit DISKPART and generate new bootable partition data to our volume where is installed windows OS (check again if you’ve set correct letter for system volume, in this case letter C)
bcdboot c:\windows /s s: /f UEFI
  •  Shutdown machine and enable booting with (U)EFI instead of BIOS

Done.

P.S. 1: You can also use gptgen for conversion from MBR to GPT to non-system disk without data loss. Simply run gptgen.exe -w \\.\\physicaldriveX where X is your desired non-system disk, then reboot.

P.S. 2: Method from “P.S 1” was also used to convert non-system 2TB MBR SAN Disk holding SQL Instance + SQL data. Conversion was successful. Just MSSQL service went down during conversion, so it needed to be manually started up as a service again.

7 thoughts on “Convert Windows System MBR disk to GPT with EFI without data loss

  1. Hello,
    I try to convert mbr to gpt with win 7 Pro onboard and giving the following command in cmd adm.:
    “C:Windowssystem32 >gptgen.exe -w \. physicaldrive0” , i get the following answer:
    “gptgen.exe” is not recognized as an internal or external command , a executable program or a file of commands.
    I would appreciate your advice.
    many thanks

    • Hi James, you must run gptgen.exe from where is saved. For example

      cd C:UsersAdministratorDownloads
      gptgen.exe -w \\.\\physicaldrive0
      
  2. Good instruction, thanks!
    I want to suggest one improvement though. gptgen does not work in Windows repair mode command prompt. But there is a different tool that does: https://sourceforge.net/projects/gptfdisk/
    The usage is similar, launch gdisk64.exe, input device name (like \.physicaldrive0), input w command and accept all warning prompts.

  3. This was extremely helpful, thank you!

    My particular scenario I think is somewhat rare, even though my BIOS was set to UEFI my boot drive was MBR and still booting, I think via UEFI-CSM. After going through your steps the old UEFI entries still existed, along with the new entries from the bcdboot command. By default my BIOS was booting with the old entries, which would give me a blue screen error, but if I entered the boot list and chose from the new entries I could boot up fine.

    I followed the instructions here to use bcdedit to remove the old entries, and now everything works perfectly!
    https://technet.microsoft.com/en-us/library/cc749510(v=ws.10).aspx

    Thank you SOOO much for your instructions! Otherwise I never would have figured out how to recreate the EFI and msr partitions!!! THANK YOU!!!

    • You’re welcome 😉
      Article was updated with “P.S. 2” experience with converting MBR SAN Disk 😎

  4. Thank you for the guide.

    I did however have to change a couple of the commands to make it work:

    – gptgen.exe -w [b]\.physicaldrive0[/b]

    Needs to be changed to:

    – gptgen.exe -w [b]\\.\\physicaldrive0[/b]

    and
    bcdboot [b]c:windows[/b] /s s: /f UEFI

    needs to be changed to:
    bcdboot [b]c:\windows[/b] /s s: /f UEFI

Leave a Reply to MyKE Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.