MBR2GPT - CMD


Overview

The MBR2GPT command is a Windows tool used to convert a disk from the Master Boot Record (MBR) partition format to the GUID Partition Table (GPT) format without modifying or deleting data on the disk. This tool is especially useful for upgrading systems to support newer hardware, particularly systems that execute UEFI (Unified Extensible Firmware Interface) rather than traditional BIOS. It’s often used in large-scale deployment environments for seamlessly transitioning between these technologies.

Syntax

The basic syntax of the MBR2GPT command is as follows:

MBR2GPT /convert [/disk:<n>] [/logs:<logfolder>] [/map:<M:P>] [/allowFullOS]

Parameters:

  • /disk:<n>: Specifies the disk number (0-based) to convert. This parameter is optional if used in the Windows Preinstallation Environment (WinPE).
  • /logs:<logfolder>: Specifies the directory for log files. This is optional; if omitted, logs are saved to the default system log directory.
  • /map:<M:P>: Adds a mapping of a specified partition from the MBR to a corresponding partition in the GPT. This parameter is optional.
  • /allowFullOS: Allows the tool to be run from within the full OS environment. Without this switch, the tool defaults to running in the PE environment only.

Options/Flags

/convert

  • Initiates the conversion from MBR to GPT. It is essential for the process to occur.

/disk:<n>

  • Important if multiple disks are present and a specific disk conversion is intended. Default varies based on environment.

/logs:<logfolder>

  • Useful for troubleshooting and auditing processes by directing the output logs to a specified directory.

/map:<M:P>

  • For users needing specific partition table mappings, enhancing flexibility during conversion.

/allowFullOS

  • Enables execution from the full operating system, expanding usability outside of WinPE.

Examples

  1. Basic Conversion inside WinPE

    MBR2GPT /convert /disk:0
    

    Converts the first disk from MBR to GPT partition style within the Windows Preinstallation Environment.

  2. Conversion with Log Directory

    MBR2GPT /convert /disk:1 /logs:C:\MBR2GPT\logs
    

    Converts the second disk and saves logs to C:\MBR2GPT\logs.

  3. Full OS Conversion

    MBR2GPT /convert /allowFullOS
    

    Converts the default selected disk from MBR to GPT while running in the full Windows operating system environment.

Common Issues

  • Secure Boot Issues: Post-conversion, systems might not boot if ‘Secure Boot’ is enabled but the firmware is set to Legacy mode. Ensure the firmware is set to UEFI mode.
  • Data Corruption: Although rare, backing up data is recommended as a precaution before conversion to avoid data loss.
  • Permission Issues: Running MBR2GPT without administrative privileges or proper flags may lead to permission errors.

Integration

In scenarios involving multiple adjustments post-disk conversion, combine MBR2GPT with commands like diskpart for partition handling and bcdboot to repair boot files:

MBR2GPT /convert /disk:0
diskpart /s setupdisk.txt
bcdboot C:\windows

Here, setupdisk.txt is a script for diskpart to prepare the disk post-conversion.

  • diskpart: A command-line utility for disk partitioning.
  • bcdboot: Used to copy critical boot files to the system partition and to create a new system BCD store.

For further reading, consult the official Microsoft documentation on MBR2GPT.