If you have started a Windows 10 migration in your corporate environment, you’ve probably heard about MBR2GPT.exe, the tool that helps convert the disk layout on a PC from the legacy Master Boot Record (MBR) to GUID Partition Table (GPT).
What you'll find in this article:
- What is mbr2gpt?
- How do you run mbr2gpt?
- What happens if you are refreshing or replacing the PC?
- What are the limitations of mbr2gpt? (it's not that same as BIOS to UEFI)
- How do you check what partition types your disks are using?
- How do you troubleshoot mbr2gpt?
What is mbr2gpt?
While the tool was introduced in the Insider Preview versions, it is officially supported in Windows 10 1703 (also known as the Creators Update). MBR2GPT.exe is the only Microsoft-supported way to convert a production disk (one with data already on it) from MBR to GPT without data loss. How do you run mbr2gpt? Well, the tool can be run from an administrative command prompt after an in-place upgrade to Windows 10 1703, or in the Windows PE (WinPE) environment. Furthermore, older versions of Windows 10 (v1511 and v1607) can be converted using the tool if booted into WinPE.
If a drive is protected with BitLocker encryption, then you will need to suspend BitLocker before converting. After conversion, delete the existing protectors (PIN, Password, Certificate, etc.) and recreate them to resume encryption. If you are using third-party disk encryption, you need to work with your ISV. It’s the only sure way to determine the minimum requirements to successfully convert disk partitions without triggering a device lock or brick while keeping the drive encrypted.
Psst...Want a roadmap to accelerating endpoint patching?
Learn more about how easy it is to increase your patching velocity. In a 30-minute informative session, Chaz Spahn, Adaptiva’s Product Evangelist will be sharing how OneSite patch is helping the world’s largest and most trusted organizations patch their endpoints automatically. Sign Up Here
How do you run mbr2gpt?
Converting Within Windows
To start the conversion within Windows, open an administrative command (or PowerShell) prompt. To see the full list of command line switches that can be passed to the tool, type mbr2gpt.exe /? Or mbr2gpt.exe /help.
The correct syntax to run the conversion tool within a Windows session is
mbr2gpt.exe /convert /allowFullOS
If you simply want to validate the disk (run a check without converting) then just replace the /convert switch with /validate.
mbr2gpt.exe /validate /allowFullOS
Converting Within WinPE
To convert disk layout in WinPE, use a Run Command Line action with the following syntax:
cmd.exe /c mbr2gpt.exe /convert /disk:<disknumber>
What if you are refreshing or replacing the PC?
If you’re re-installing Windows to the current disk, or if you’re replacing the drive or computer, you will not be using the MBR2GPT.exe tool. If the system is booted in UEFI mode before the Format and Partition Disk step happens in the Install Operating System group, the Task Sequence engine will happily format the disk for GPT. If you have created a sequence that restores user data, it will still be able to be restored.
What are the limitations of mbr2gpt?
The first and perhaps most important limitation is that MBR2GPT.exe is not the same thing as “BIOS to UEFI”. MBR2GPT.exe is a tool to convert partition layout while BIOS to UEFI is the process of converting a system’s firmware mode from BIOS to UEFI.
While MBR2GPT.exe can be run from the full OS, or in WinPE, it should be run before the conversion of BIOS to UEFI during an in-place upgrade and most preferably in WinPE. If the tool is run after the firmware mode is converted, and for some reason is unsuccessful with the conversion, the device will essentially be bricked until the PC is manually converted back to BIOS mode.
If you are performing a PC refresh or replace, the PC should be converted before the “Format and Partition Disk” step runs in the Install Operating System Group. It is possible to do this later in the sequence, but this route is more reliable. This is because this group has two Format and Partition actions with variables on them that read whether the PC is in BIOS mode or UEFI mode and formats and partitions the disk accordingly. As you can see below, the image on the left depicts what the Task Sequence engine will do to the disk if the PC is running in BIOS mode, and the image on the right shows what it will do to the disk if it is in UEFI mode. The most important takeaway is that BIOS mode means the disk will be formatted in MBR layout and UEFI means it will be formatted in GPT layout.
Legacy versions of Windows aren’t officially supported. If you successfully convert the partition type into GPT layout, you’ve stepped out of the realm of support. Typically, “not officially supported” means it can likely be done, but it isn’t well tested internally, so you’re on your own if something goes wrong or if you have questions. It would be better to upgrade the system to a version of Windows that is supported.
Once the disk layout has been converted, you cannot undo it. Furthermore, if the layout was performed during an in-place upgrade, you will not be able to go back to a previous version of Windows. I was able to test and validate this limitation in all three major PC vendors (Dell, Lenovo, HP).
To use the tool, the disk to be converted needs to have less than four partitions (meaning three partitions is the maximum). In testing the conversion tool, it was noted that Dell models create an extra recovery partition during an in-place upgrade which can cause the conversion tool to fail if you hit the limit of partitions before the upgrade runs. To get around this, I deleted all recovery partitions leaving the PC with only two partitions. During the in-place upgrade, the Dell PC created a third partition (as expected) which didn’t cause the conversion tool to fail. The HP and Lenovo models I tested did not create extra partitions during the in-place Upgrade.
If you are going to use one sequence to handle all hardware models, ensure that you are supplying the correct driver package for the model running the upgrade and that the engine can read and process the variable. If the variable you set on your driver package is incorrect, setup.exe will not use it. While the discussion about why you need to provide driver packages during an in-place upgrade is a bit off topic, it is important to note. It matters because some of the vendor models that I tested failed the MBR2GPT.exe conversion later in the in-place upgrade when I did not also provide driver packages to them. This may not be true for every vendor model, but happened consistently enough in my testing that to be deemed important to take note of.
How do you check what partition type your disks are using?
Open an administrative command prompt and type the following:
diskpart
select disk <disk number>
list part
sel part <partition number>
detail part
If the disk is using MBR partition type, it will display 07 for the type in the detail part command as pictured below on this Windows 7 PC.
diskpart
list disk
Any disk with an asterisk under GPT in the table is in GPT layout as pictured on this Windows 10 PC.
How do you troubleshoot mbr2gpt?
When the MBR2GPT.exe tool is run, it creates four logs in the %windir% directory (C:\Windows). The four logs are setuperr.log, setupact.log, diagerr.xml, and diagwrn.xml with setuperr.log having the most detailed information. In the example below, I ran the tool and saw in setuperr.log that it failed because there are too many partitions.
A full list of error codes for the tool can be found on TechNet under the Return Codes section here docs.microsoft.com. Note that these error codes are specific to the tool itself and shouldn’t be confused with error codes that the Windows 10 setup or the Task Sequence engine may throw.
There are three issues that you may encounter when you start a Windows 10, version 1903-based computer:
- When you run the mbr2gpt.exe command, the process exits without converting the drive.
- When you manually run mbr2gpt.exe command in a Command Prompt window, there is no output from the tool.
- When mbr2gpt.exe runs inside an imaging process such as a Microsoft Endpoint Manager task sequence, an MDT task sequence, or by using a script, you receive the following exit code: 0xC0000135/3221225781.
To learn more about the cause and workaround, find "Known Issues" in this article: MBR2GPT.EXE
About Adaptiva OneSite Health
Adaptiva's OneSite Health instantly identifies issues on endpoints no matter their location, without requiring direct control of user devices. Automated health checks, authoring of custom workflows, and instant remediation reduce IT support tickets, manual workloads, and disruptions. Easily monitor and update configurations to comply with organizational requirements.