You can extend the capacities of your system disks and data disks online to satisfy your growing business needs and increased application requirements. The changes take effect immediately after you complete the operation. You do not need to restart the ECS instance, create a new disk, or migrate data.

Prerequisites

Before you resize a disk, make sure that your resources meet the following requirements:
  • The disk to be resized is in the In Use (In Use) state, and the instance to which the disk is attached is in the Running (Running) state.
  • Check whether the instance to which the disk is attached meets the following conditions. If not, see Resize disks offline (Linux).
    • The instance is I/O optimized.
    • Run the uname -a command to check whether the kernel version is 3.6.0 or later.

Background information

Note If a data disk adopts the MBR partition format, you cannot resize the data disk to more than 2 TiB. If you want to resize a data disk to 2 TiB while the MBR partition format is used, we recommend that you create and attach another data disk. Format a GPT partition and copy the data in the MBR partition to the GPT partition.
The following limits apply when you resize disks online:
  • For more information about capacity limits of resizing system disks and data disks, see Overview.
  • You can resize ultra disks, standard SSDs, and enhanced SSDs (ESSDs) online.
  • After you renew a subscription instance and downgrade its configurations, you cannot resize the subscription disks attached to the instance during the remainder of the current billing cycle.
  • You cannot shrink an resized disk by means such as rolling it back.
  • For Linux instances, only system disks of instances that are created by using public images listed in the following table can be resized online.
    Distribution Public image version
    CentOS 7 CentOS 7.2 and later
    CentOS 6 CentOS 6.8 and later
    Ubuntu 16 All Ubuntu 16 versions
    Ubuntu 18 All Ubuntu 18 versions
    Debian 8 Debian 8.9 and later
    Debian 9 All Debian 9 versions
    Red Hat Enterprise Linux 7 Red Hat Enterprise Linux 7.4 and later (with SAP)
    Red Hat Enterprise Linux 6 Red Hat Enterprise Linux 6.9 and later
    Red Hat Enterprise Linux 8 All Red Hat Enterprise Linux 8 versions
    SUSE 12 SUSE 12 SP2 and later (with SAP)
    OpenSUSE openSUSE 42.3 and later

Step 1: Create a normal snapshot

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Storage & Snapshots > Disks.
  3. In the top navigation bar, select a region.
  4. Select a disk category, and then click Create Snapshot in the Actions column.
  5. In the dialog box that appears, complete the following operations:
    1. Enter a snapshot name in the Snapshot Name field.
    2. Binds one or more tags to the snapshot.
    3. Click OK.
  6. In the Storage & Snapshots > Snapshots view the snapshot task.

Step 2: Resize a single disk online

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Storage & Snapshots > Disks.
  3. In the top navigation bar, select a region.
  4. Find the disk to be resized and choose More > Resize Disk in the Actions column.
  5. Select Resize Online and set the Capacity after Resizing parameter.
  6. Confirm the fee, read and select ECS Service Terms and Product Terms of Service, and then click Resize.
  7. Read the notes and complete the payment.
    Note If you do not select Resize Online or the ECS instance does not meet the requirements of Resize Online, use the console or call the RebootInstance operation to restart the instance for the changes to take effect. For more information, see Restart an instance and RebootInstance.

Step 3: View the disks partition.

  1. Remotely connect to an ECS instance.
  2. Run the fdisk -lucommand to check the current disk size.
    查看云盘分区情况
    No. Partition Description
    /dev/vda1 In the case of "System"="Linux", the system disk uses the MBR partition table format.
    /dev/vdb1 In the case of "System"="Linux", the data disk uses the MBR partition table format.
    /dev/vdc1 In the case of "System"="GPT", the data disk uses the GPT partition table format.
  3. Run the blkid command to check the file system type.
    查看文件系统

Step 4: Resize partitions

  1. Remotely connect to an ECS instance.
  2. Install gdisk.
    If your partition is in GPT format, you must perform this step. If your partition is in MBR format, you can skip this step.
    yum install gdisk -y
  3. Run the growpart /dev/vda 1command to resize the partition.
    The following example shows that the first partition /dev/vda1 of the system disk is resized.growpart

Step 5: Resize the file system

  1. Remotely connect to an ECS instance.
  2. You can use one of the following methods based on your file system type.
    • If the file system is ext*, such as ext3 and ext4, run theresize2fs /dev/vda1command.
      # Resize the file system of system disks (/dev/vda1)
      resize2fs /dev/vda1
      
      # Resize the file system of data disks (/dev/vdb1)
      e2fsck -f /dev/vdb1     // Check the status of the file system
      resize2fs /dev/vdb1
      Note You need to modify the partition name (/dev/vda1 and /dev/vdb1) according to the actual situation.
    • If the file system is XFS, run thexfs_growfs /media/vdccommand.
      Note You need to modify the mount point (/media/vdc) according to the actual situation.
  3. Run thedf -Thcommand to check the size of the disk partition.
    查看扩容结果