Last updated：2021-07-01 14:36:43
If the storage space of an EBS volume, either a system disk or data disk, no longer meets your business requirements, you can expand the capacity of the EBS volume. This topic describes how to expand the capacity of an EBS volume without the need to suspend the KEC instance to which the EBS volume is attached. In this topic, the operating system of the KEC instance is Linux.
EBS volumes are scalable storage devices. You can expand the capacity of an existing EBS volume at any time to increase its storage space without affecting the data on the EBS volume.
After you expand the capacity of an EBS volume in the EBS console, you need to allocate the expanded capacity to partitions. The partitions can be existing partitions or partitions that are newly created and formatted. Then, resize the file systems of the partitions, so that the expanded capacity can be recognized. For more information, see Resize partitions and file systems (Linux).
The maximum capacity of an EBS volume that uses MBR partitioning is 2 TB. If the capacity exceeds this limit, the excess capacity cannot be used. You may need to expand the capacity of an EBS volume that uses MBR partitioning to more than 2 TB. In this case, we recommend that you create and attach a data disk that uses GPT partitioning and then copy the data to the new disk.
The following table describes the requirements that must be met before an online capacity expansion is performed on an EBS volume attached to a KEC instance whose operating system is Linux.
|KEC instance||1. The KEC instance must be in the Running state.
2. All types, including GPU types, of KEC instances support the online capacity expansion of EBS volumes.
3. During the online capacity expansion, the status of the KEC instance cannot be changed. For example, you cannot restart, shut down, or delete the KEC instance.
4. All KEC instances to which SSD volumes of EBS 3.0 or EHDD volumes can be attached support online capacity expansion.
5. The public or custom image used by the KEC instance must support the online capacity expansion of EBS volumes. For more information, see the following table.
|EBS volume||1. The EBS volume for which you want to expand the capacity online must be in the In use state.
2. The EBS volume must be an SSD volume of EBS 3.0 or an EHDD volume.
3. The capacity after the expansion must be greater than the original capacity but cannot exceed the corresponding upper limit. For more information about the upper limits on capacity, see Overview.
Operating systems that support the online capacity expansion of EBS volumes
The following table describes the Linux images that support the online capacity expansion of EBS volumes. Such Linux images include public Linux images, and custom Linux images created based on public images.
|CentOS 7||7.X 64-bit version|
|CentOS 8||8.X 64-bit version|
|Debian 9||9.6 64-bit version|
|Debian 10||10.6 64-bit version|
|Ubuntu Server 14||14.04 64-bit version|
|Ubuntu Server 16||16.04 64-bit version|
|Ubuntu Server 18||18.04 64-bit version|
|Ubuntu Server 20||20.04 64-bit version|
|Fedora||20 64-bit version|
If your KEC instance does not support the online capacity expansion of EBS volumes, you can use the offline capacity expansion feature. For more information, see Expand the capacity of an EBS volume offline (Linux).
|Operating system||CentOS 8.2 64-bit|
|System disk||/dev/vda: uses MBR partitioning and ext4 file systems. You want to expand the capacity of the disk from 50 GB to 70 GB.|
|Data disk||/dev/vdb: uses MBR partitioning and ext4 file systems. You want to expand the capacity of the disk from 50 GB to 100 GB.
/dev/vdc: uses GPT partitioning and xfs file systems. You want to expand the capacity of the disk from 50 GB to 150 GB.
Note: To prevent data loss caused by misoperations, we recommend that you create a snapshot to back up data before you expand the capacity of an EBS volume.
1. If an EBS volume qualifies for online capacity expansion but you do not select the Online expansion check box, an offline capacity expansion will be performed on the EBS volume.
2. After you expand the capacity of an EBS volume in the EBS console, the expanded capacity is not available for use yet. You must log in to the operating system of the KEC instance to which the EBS volume is attached, and allocate the expanded capacity by resizing partitions and file systems.
|EBS volume||Partition||Partition description|
|/dev/vda is the system disk with a capacity of 70 GB.||/dev/vda1||MBR partition, with a capacity of 50 GB|
|/dev/vdb is the data disk with a capacity of 100 GB.||/dev/vdb1||MBR partition, with a capacity of 50 GB|
|/dev/vdc is the data disk with a capacity of 150GB.||/dev/vdc1||GPT partition, with a capacity of 50GB|
If the output shows that the capacity of the EBS volume for which you have expanded the capacity is still the same as the original capacity, the capacity expansion failed. We recommend that you restart the KEC instance in the console.
|Partition||File system type||Mount point|
|/dev/vda1||ext3||Mounted to /|
|/dev/vdb1||ext4||Mounted to /mnt/data_disk01|
|/dev/vdc1||xfs||Mounted to /mnt/data_disk02|
yum install gdisk -y
apt-get install gdisk -y
yum install -y cloud-utils-growpart
apt-get install -y cloud-guest-utils
In this example, resize the /dev/vdb1 partition on the /dev/vdb data disk. Separate /dev/vdb and 1 with a space in the command. If you need to resize other partitions, modify the command as needed. The following figure shows the output.
growpart /dev/vdb 1
In the operating system of your KEC instance, resize a file system by running one of the following commands based on the type of the file system.
If the type of the file system is in the format of ext*, such as ext4, run one of the following commands based on the type of the EBS volume.
To resize the file system of the /dev/vda1 partition on the /dev/vda system disk, run the following command:
To resize the file system of the /dev/vdb1 partition on the /dev/vdb data disk, run the following command:
Note: In the preceding commands,
/dev/vdb1are partition names. You must change them based on your business requirements.
If the type of the file system is xfs, run the following command:
Note: In the preceding command,
/mnt/data_disk02is the mount point of the
/dev/vdc1partition. You must change it based on your business requirements.
Run the following command to check the resizing results:
Did you find the above information helpful?
Please give us your feedback.
Thank you for your feedback.