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
The conversion does not typically cause data loss. However, to prevent accidental data loss, create a snapshot to back up the disk.
-
Log on to the ECS instance.
-
Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.
-
Go to the instance details page. Click Connect > Workbench. Follow the prompts to log on and open the terminal.
-
-
Check the current partition format.
Run
sudo fdisk -luto check the Partition type (Disklabel type) and Target device name (Disk).
In this example, the target device is
/dev/vdb, theDisklabelisdos(MBR partition), and its capacity exceeds 2 TiB. Convert the partition. If theDisklabelis notMBR, directly extend the partition. -
Convert the partition type.
-
Install the
gdisktool.-
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
-
-
Convert the MBR partition to a GPT partition.
Replace
<device name to convert>with the target device name from Step 2.ImportantThe
sgdiskcommand 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, runsudo sgdisk -g /dev/vdb.The message
The operation has completed successfullyconfirms success.
-
-
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 typeofgptconfirms 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
-
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.
ImportantDisk data is unavailable during the conversion and services may be interrupted. Perform this during a maintenance window.
-
Log on to the ECS instance.
-
Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.
-
Go to the instance details page. Click Connect > Workbench. Set the connection method to Terminal, enter your credentials, and log on.
-
-
Check whether partition conversion is required.
-
On the Windows Server desktop, right-click the
icon and click Disk Management. -
In Disk Management, right-click the target disk and select Type.

-
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.
-
-
Convert the partition type.
-
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.
ImportantDelete Volume purges all data on the volume. Ensure you have backed up the data before proceeding.
-
After all volumes are deleted, right-click the disk and select Convert To GPT Disk.
-
Verify the conversion.
Right-click the disk and select Type. On the Volumes tab, a Partition Style of
GPTconfirms success.
-
-
Repartition the disk.
-
Right-click the Unallocated area of the disk and select New Simple Volume.
-
In the New Simple Volume Wizard, follow these steps:
-
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.
-
On the Assign Drive Letter Or Path page, select Assign The Following Drive Letter, choose a drive letter, and click Next.
-
On the Format Partition page, select Format This Volume With The Following Settings, configure the settings, and click Next.
-
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.
-
Copy the data from the newly attached disk to the original data disk.
-
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 typenot displayed in the output of thefdisk -lucommand?-
If
Disk label typeis missing, check theSystemfield.Linuxindicates MBR, andGPTindicates GPT. -
Some earlier
fdiskversions may not display GPT partition tables correctly. Usegdisk -l /dev/vdbto 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 -gcommand?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 gdiskcommand?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 kCause: 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.