All Products
Search
Document Center

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

Last Updated:Aug 17, 2026

MBR partitions cannot exceed 2 TiB. Convert the partition format from MBR to GPT to use a data disk larger than 2 TiB.

Procedure

This procedure applies only to data disks already resized beyond 2 TiB.

Linux data disk

Important

The conversion 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 ECS instance.

    1. Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.

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

  2. Check the current partition format.

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

    
    Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 36124873-A4C8-46EF-B436-FFE48CB27EFE
    
    Device      Start       End   Sectors  Size Type
    /dev/vda1    2048      6143      4096    2M BIOS boot
    /dev/vda2    6144    415743    409600  200M EFI System
    /dev/vda3  415744 104857566 104441823 49.8G Linux filesystem
    
    Disk /dev/vdb: 3 TiB, 3324304687104 bytes, 6492782592 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x1441bd90
    
    Device     Boot Start       End   Sectors Size Id Type
    /dev/vdb1        2048 104857599 104855552  50G 83 Linux
    

    In this example, the target device is /dev/vdb, the Disklabel is dos (MBR partition), and its capacity exceeds 2 TiB. Convert the partition. If the Disklabel is not MBR, 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.

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

      Important

      The sgdisk command converts only entire devices, such as /dev/vdb. Do not run it on a partition such as /dev/vdb1. Running it on a partition corrupts the file system.

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

      The message The operation has completed successfully confirms success.

  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>
    Example: run sudo fdisk -lu /dev/vdb.

    A Disklabel type of gpt confirms success. You can now extend the partition and file system.

    If corruption occurs or the conversion fails, roll back the disk from a snapshot to recover the data.

Windows data disk

Step 1: Convert the partition format and repartition the disk

  1. The conversion deletes all data on the disk. Create a snapshot to back up your data. You will recover data from this snapshot after the conversion.

    Important

    Disk data is unavailable during the conversion and services may be interrupted. Perform this during a maintenance window.

  2. Log on to the ECS instance.

    1. Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.

    2. Go to the instance details page. Click Connect > Workbench. Set the connection method to Terminal, enter your credentials, and log on.

  3. Check whether partition conversion is required.

    1. On the Windows Server desktop, right-click the Start icon icon and click Disk Management.

    2. In Disk Management, right-click the target disk (such as Disk 1) and select Type.

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

      If the Partition Style is MBR and the disk exceeds 2 TiB, convert the partition format. Otherwise, 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, click Yes.

      If the volume cannot be deleted, a program is likely using it. To release the file lock, restart the instance during off-peak hours and try again.
      Important

      Delete Volume purges all data on the volume. Ensure you have backed up the data before proceeding.

    2. After all volumes are deleted, right-click the disk and select Convert To GPT Disk.

    3. Verify the conversion.

      Right-click the disk and select Type. On the Volumes tab, a Partition Style of GPT confirms success.

  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.

        Use the default value for a single partition, or customize the size for multiple partitions.
      2. On the Assign Drive Letter Or Path page, select Assign The Following Drive Letter, choose a drive letter, and click Next.

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

      4. Review your settings and click Completed.

Step 2: Recover the disk data

Do not roll back the disk from a snapshot. Doing so reverts the partition format to MBR.

  1. Create a data disk from the snapshot.

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

  3. 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 after confirming your services run correctly. Detach and then release the temporary disk.

FAQ

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

    • If Disk label type is missing, check the System field. Linux indicates MBR, and GPT indicates GPT.

    • Some earlier fdisk versions may not display GPT partition tables correctly. Use gdisk -l /dev/vdb 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 disk has less than 33 sectors of free space at the end, which is insufficient for the conversion.

    Solution: Extend the disk capacity in the ECS console, 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) has insufficient space.

    Solution: Free up space in the download directory and retry the conversion.