When system disks or data disks do not have sufficient storage space, you can resize the disks in the Elastic Compute Service (ECS) console to extend the capacity of the disks. This topic describes how to resize a disk online or offline. After you resize a disk online, you do not need to restart the associated instance for the new disk size to take effect. After you resize a disk offline, you must restart the associated instance for the new disk size to take effect.
Prerequisites
The instance to which the disk that you want to resize is attached meets the following requirements:
If you want to resize the disk online, the instance is in the Running state.
If you want to resize the disk offline, the instance is in the Running or Stopped state.
The disk that you want to resize meets the following requirements:
The disk is in the In Use (In_use) or Unattached (Available) state.
No snapshot is being created for the disk. If a snapshot is being created for the disk, wait until the snapshot is created and then resize the disk.
If the disk is a new data disk, the disk is initialized. For more information, see Overview.
The disk that you want to resize is a cloud disk or an elastic ephemeral disk.
Local disks do not support disk resizing. Do not resize local disks. If you resize a local disk, the partition table and file system structure on the disk may be corrupted, which affects business continuity.
Preparations
(Recommended) Create a snapshot for the disk that you want to resize to back up disk data.
To prevent data loss caused by accidental operations during the resizing process, we recommend that you create a snapshot for the disk to back up disk data before you resize the disk. For more information, see Create a snapshot. You are charged for snapshots. For more information, see Snapshots.
Get familiar with the overall process of disk resizing. For more information, see Overview.
Procedure
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the Cloud Disk tab, find the disk that you want to resize and resize the disk.
If the disk is attached to an instance that is in the Running state, click Resize in the Actions column.
If the disk is in the Unattached state or the disk is attached to an instance that is in the Stopped state, choose
in the Actions column.
You can also select multiple disks and click Resize in the lower part of the Cloud Disk tab to batch resize the disks.
In the Determine Disk and Read Notes step, click I Understand Risks and Have Backed Up Data. Proceed.
In the Configure Resizing Method and New Size step, configure the parameters.
①: Configure the New Disk Size parameter. The value cannot be smaller than the current disk size.
②: Configure the Resizing Method parameter. Valid values:
Online Resizing: After you resize a disk attached to an instance online, the new disk size immediately takes effect without the need to restart the instance.
NoteIf the business deployed on an instance does not allow instance restarts, select Online Resizing to resize the disk.
Offline Resizing: After you resize a disk attached to an instance offline, you must restart the instance in the ECS console or by calling an API operation for the new disk size to take effect. The new disk size does not take effect if you run the
reboot
command in the instance to restart the instance. For more information, see Restart an instance.NoteThe offline resizing method is suitable for the following scenarios:
If an instance is in the Stopped state or the instance type does not support the online resizing of disks, you can resize the disks attached to the instance only offline. For information about the instance types that do not support the online resizing of disks, see the Which instance types do not support the online resizing of disks? question in the "FAQ" section of this topic.
If a disk is in the Unattached state, you can resize the disk only offline.
If an instance is a Windows instance on which a virtio driver of a version earlier than 58011 is installed, select Offline Resizing. If you select Online Resizing to resize a disk on the Windows instance, the resize operation does not take effect. Before you can resize a disk on the Windows instance online, update the virtio driver version. For information about how to view and update the virtio driver version, see Update the Red Hat virtio driver on a Windows instance.
③: In the lower-left corner of the Resize Cloud Disk page, confirm the price and click OK.
In the Confirm Resizing Results step, confirm that Successful is displayed in the Resizing Result column. Then, click Next Step: Extend Partitions and File Systems in the lower-left corner of the Resize Cloud Disk page.
Extend the partitions and file systems of the disk into the added disk space for the new disk size to take effect.
Use Cloud Assistant
(Conditionally required) If you resized the disk offline, perform one of the following operations based on your business scenario:
If the disk that you performed the Offline Resizing operation is in the Unattached state, attach the disk to an instance. For more information, see Attach a data disk.
After you only mount file systems by using Cloud Assitant, wait for the instructions to extend the partitions and file systems of the disk, which appears on the following page.
If the disk that you performed the Offline Resizing operation is in the In Use state, click Restart Instance for the new disk capacity to take effect. Wait for the instructions to extend the partitions and file systems of the disk, which appears on the following page.
NoteYou can also restart the instance in the ECS console or by calling an API operation. For more information, see Restart an instance.
On the Use Cloud Assistant tab in the Extend Partitions and File Systems section, click Run Preceding Command.
In the Send Remote Commands dialog box, click Run. The system runs the commands on the instance to extend the partitions and file systems of the disk. If Success is displayed, the partitions and file systems of the disk are extended.
Log on to the instance and extend the partitions and file systems of the disk
If your environment does not support Cloud Assistant or you accidentally close the Cloud Assistant page, you can log on to the instance and extend the partitions and file systems of the disk. Select one of the following methods based on your operating system:
If your operating system is Linux, extend the partitions and file systems of the disk as described in Extend the partitions and file systems of disks on a Linux instance.
If your operating system is Windows, extend the partitions and file systems of the disk as described in Extend the partitions and file systems of disks on Windows instances.