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
The conversion process does not typically cause data loss. However, to prevent accidental data loss, create a snapshot to back up the disk.
Log on to the Elastic Compute Server (ECS) instance.
Go to ECS console - Instances. In the top navigation bar, select the target region and resource group.
Go to the instance details page. Click Connect and select Workbench. Follow the on-screen prompts to log on and open the terminal.
Check the current partition format.
Run the
sudo fdisk -lucommand to check the disk's Partition type (Disklabel type) and Target device name (Disk).
In this example, the target device is
/dev/vdb, theDisklabelisdos(indicating anMBRpartition), and its capacity has been increased to more than 2 TiB. You must convert the partition. Otherwise, you can directly extend the partition.Convert the partition type.
Install the
gdisktool.For Alibaba Cloud Linux and CentOS:
type sgdisk || sudo yum install -y gdiskFor Ubuntu and Debian:
sudo apt-get update type sgdisk || sudo apt-get install -y gdisk
Convert the MBR partition to a GPT partition.
In the command, replace
<device name to convert>with the target device name from Step 2.ImportantThe
sgdiskcommand 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, runsudo sgdisk -g /dev/vdb.The message
The operation has completed successfullyconfirms the command was successful.
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 typeofgptconfirms 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
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.
ImportantDuring the conversion, the disk data is unavailable, and your services may be interrupted. Perform this operation during a scheduled maintenance window.
Log on to the Elastic Compute Server (ECS) instance.
Go to ECS console - Instances. In the top navigation bar, select the target region and resource group.
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.
Check whether a partition conversion is required.
On the Windows Server desktop, right-click the
icon and then click Disk Management.In the Disk Management window, right-click the target disk and select Properties.

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.
Convert the partition type.
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.
ImportantDelete Volume purges all data on the volume. Before you delete the volume, ensure you have backed up the data.
After deleting all volumes on the target disk, right-click the disk and select Convert To GPT Disk.
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.
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.
You can use the default value to create a single partition, or customize the volume size to create multiple partitions.
On the Assign Drive Letter Or Path page, select Assign The Following Drive Letter, choose a drive letter, then click Next.
On the Format Partition page, select Format This Volume With The Following Settings, configure the format settings, then click Next.
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.
Manually 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 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 typenot displayed in the output of thefdisk -lucommand?If the
Disk label typefield is missing, you can check theSystemfield.Linuxindicates an MBR partition, andGPTindicates a GPT partition.Some earlier versions of
fdiskmay not correctly display GPT partition tables. You can use thegdisk -l /dev/vdbcommand 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 -gcommand?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 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) does not have enough space.Solution: Free up space in the download directory, then convert the partition format.