All Products
Search
Document Center

Elastic Compute Service:Convert a data disk from MBR to GPT

Last Updated:Nov 20, 2025

An Master Boot Record (MBR) partition cannot be resized beyond 2 TiB. To use a data disk larger than 2 TiB, you must first convert its partition format from MBR to GUID Partition Table (GPT).

Procedure

This procedure applies only to data disks that you have already resized to be larger than 2 TiB.

Linux data disk

Important

The conversion process does not typically cause data loss. However, to prevent accidental data loss, create a snapshot to back up the disk.

  1. Log on to the Elastic Compute Server (ECS) instance.

    1. Go to ECS console - Instances. In the top navigation bar, select the target region and resource group.

    2. Go to the instance details page. Click Connect and select Workbench. Follow the on-screen prompts to log on and open the terminal.

  2. Check the current partition format.

    Run the sudo fdisk -lu command to check the disk's Partition type (Disklabel type) and Target device name (Disk).

    image

    In this example, the target device is /dev/vdb, the Disklabel is dos (indicating an MBR partition), and its capacity has been increased to more than 2 TiB. You must convert the partition. Otherwise, you can directly extend the partition.

  3. Convert the partition type.

    1. Install the gdisk tool.

      • For Alibaba Cloud Linux and CentOS:

        type sgdisk || sudo yum install -y gdisk
      • For Ubuntu and Debian:

        sudo apt-get update
        type sgdisk || sudo apt-get install -y gdisk
    2. Convert the MBR partition to a GPT partition.

      In the command, replace <device name to convert> with the target device name from Step 2.

      Important

      The sgdisk command can only convert an entire device, such as /dev/vdb. Do not run it on a partition, such as /dev/vdb1. Running the command on a partition will corrupt the file system.

      sudo sgdisk -g <device name to convert>
      For example, if the target device name is /dev/vdb, run sudo sgdisk -g /dev/vdb.

      The message The operation has completed successfully confirms the command was successful.

  4. Check the conversion result.

    Replace <device name to convert> with the target device name from Step 2.

    sudo fdisk -lu <device name to convert>
    For example, run sudo fdisk -lu /dev/vdb.

    In the command output, a Disklabel type of gpt confirms the conversion was successful. You can now extend the partition and file system.

    If data corruption occurs or the conversion fails, you can use a snapshot to roll back the disk and recover the data.

Windows data disk

Step 1: Convert the partition format and repartition the disk

  1. The conversion process deletes all data on the disk. You must create a snapshot to back up your data. After the conversion, you will recover the data from this snapshot.

    Important

    During the conversion, the disk data is unavailable, and your services may be interrupted. Perform this operation during a scheduled maintenance window.

  2. Log on to the Elastic Compute Server (ECS) instance.

    1. Go to ECS console - Instances. In the top navigation bar, select the target region and resource group.

    2. Go to the instance details page. Click Connect and select Workbench. Set the connection method to Terminal, enter your username and password, then log on to the instance.

  3. Check whether a partition conversion is required.

    1. On the Windows Server desktop, right-click the 开始图标 icon and then click Disk Management.

    2. In the Disk Management window, right-click the target disk and select Properties.image

    3. In the dialog box that appears, click the Volumes tab and check the Partition Style.

      If the Partition Style is MBR and the disk capacity exceeds 2 TiB, you must convert the partition format. Otherwise, you can skip this procedure and directly extend the partition and file system.

  4. Convert the partition type.

    1. Right-click the volume on the target disk and select Delete Volume.... In the Delete Simple Volume dialog box, click Yes.

      If the volume cannot be deleted, it is likely in use by a program. To release the file lock, restart the instance during off-peak hours, then try deleting the volume again.
      Important

      Delete Volume purges all data on the volume. Before you delete the volume, ensure you have backed up the data.

    2. After deleting all volumes on the target disk, right-click the disk and select Convert To GPT Disk.

    3. Verify the conversion.

      Right-click the disk and select Properties. Go to the Volumes tab. If the Partition Style is GPT, the conversion was successful.

  5. Repartition the disk.

    1. Right-click the Unallocated area of the disk and select New Simple Volume.

    2. In the New Simple Volume Wizard, follow these steps:

      1. On the Specify Volume Size page, set the Simple Volume Size and click Next.

        You can use the default value to create a single partition, or customize the volume size to create multiple partitions.
      2. On the Assign Drive Letter Or Path page, select Assign The Following Drive Letter, choose a drive letter, then click Next.

      3. On the Format Partition page, select Format This Volume With The Following Settings, configure the format settings, then click Next.

      4. Review your settings and click Finish.

Step 2: Recover the disk data

Do not use a snapshot to roll back the disk. Doing so will revert the partition format to MBR.

  1. Create a data disk from the snapshot.

  2. Attach the new data disk to the ECS instance.

  3. Manually copy the data from the newly attached disk to the original data disk.

  4. To avoid unnecessary charges, delete the snapshot and the temporary data disk created from it after you confirm that your services are running correctly. You can do this by detaching and then releasing the temporary disk.

FAQ

  • Why is Disklabel type not displayed in the output of the fdisk -lu command?

    • If the Disk label type field is missing, you can check the System field. Linux indicates an MBR partition, and GPT indicates a GPT partition.

    • Some earlier versions of fdisk may not correctly display GPT partition tables. You can use the gdisk -l /dev/vdb command to view the partition type.

  • What do I do if the "Secondary partition table overlaps the last partition by 33 blocks!" message appears when I run the sgdisk -g command?

    Cause: The remaining space at the end of the disk is less than 33 sectors, which is insufficient for the partition conversion.

    Solution: In the ECS console, extend the disk capacity, then convert the partition format.

  • What do I do if the "Insufficient space in download directory" message appears when I run the type sgdisk || yum install -y gdisk command?

    Error message:

    Error downloading packages:
      gdisk-0.8.10-3.1.al7.x86_64: Insufficient space in download directory /var/cache/yum/x86_64/2.1903/updates/packages
        * free   0
        * needed 190 k

    Cause: The download directory (/var/cache/yum/x86_64/2.1903/updates/packages) does not have enough space.

    Solution: Free up space in the download directory, then convert the partition format.