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. After you resize a disk offline, you must restart the associated instance.

Scenario

When system disks or data disks do not have sufficient space, you can resize the disks in the Elastic Compute Service (ECS) console to increase storage space.
Note Disks cannot be shrunk. After the new capacity of a resized disk takes effect, the disk cannot be shrunk. We recommend that you properly plan the storage capacity. If you want to shrink a disk, use the Alibaba Cloud Server Migration Center (SMC). For more information, see Shrink a disk.

Prerequisites

  • The instance to which the disk is attached meets the following requirements:
    • If you want to resize the disk online, the instance is in the Running (Running) state.
      Note Instances that use early instance types do not support online resizing of disks. For more information, see the FAQ section of this topic.
    • If you want to resize the disk offline, the instance is in the Running (Running) or Stopped (Stopped) state.
  • The disk meets the following requirements:
    • The disk is in the In Use (In Use) or Unattached (Unattached) state. After the disk is resized in the ECS console, you must extend the partitions and file systems of the disk from the operating system of the instance. If the disk is in the Unattached state, attach the disk to an instance.
    • The disk can be an enhanced SSD (ESSD), ESSD AutoPL disk, standard SSD, or ultra disk.

Procedure

  1. Optional: Create snapshots for the disk that you want to resize to back up data.
    For more information, see Create a snapshot of a disk.
    Note You are charged for using snapshots. For more information, see Snapshots.
  2. Go to the Cloud Disk tab on the Instance Details page.
    1. Log on to the ECS console.
    2. In the left-side navigation pane, choose Instances & Images > Instances.
    3. In the top navigation bar, select the region where the ECS instance is located.
    4. Find the instance to which the disk is attached and click the ID of the instance.
    5. On the Instance Details page, click the Cloud Disk tab.
  3. Find the disk and choose More > Resize in the Actions column.
    To batch resize disks, log on to the ECS console by using your Alibaba Cloud account and choose Storage & Snapshots > Disks in the left-side navigation pane. On the Disks page, select the disks that you want to resize and click Resize in the lower part of the page.
    Note
    • You can use only Alibaba Cloud accounts instead of RAM users to batch resize disks. To batch resize disks, log on to the ECS console by using your Alibaba Cloud account.
    • Disks that are attached to the same instance cannot be batch resized.
  4. In the Determine Disk and Read Notes step, click I Understand Risks and Back Up Data. Proceed.
  5. In the Configure Resizing Method and New Size step, configure parameters.
    1. Set New Size. The specified value cannot be smaller than the current disk size.
    2. Select a method to resize the disk.
      • Resize Online: the default recommended resize method. After a disk is resized online, the instance does not need to be restarted for the resize operation to take effect.
      • Resize Offline: After a disk is resized offline, the instance must be restarted for the resize operation to take effect.
      Note
      • If business deployed on instances does not support instance restarts, use the online resize method.
      • If your instance is in the Stopped state or if your instance uses an early instance type that does not support online resizing, use the offline resize method. For information about instance types that do not support online resizing, see FAQ.
    3. Read and select I have read and agreed to ECS Terms of Service.
    4. Confirm the price and click OK.
    5. Complete the payment.
  6. In the Confirm Resizing Results step, click Next Step: Extend Partitions and File Systems when Successful is displayed in the Resizing Result column.
  7. Optional:This step applies only to offline resizing. In the Extend Partitions and File systems step, click Restart Instance to restart the instance to which the disk is attached for the resize operation to take effect.
    Important If you run the reboot command within the instance to restart the instance, the resize operation cannot take effect.
  8. View the partition information of the disk and select a method to extend the partitions and file systems based on the actual scenario.
    • Documentation: Connect to the instance and use the CLI within the operating system to extend partitions and file systems.

      For more information, see Extend the partitions and file systems of disks on a Linux instance or Extend the partitions and file systems of a disk on a Windows instance.

    • Cloud Assistant: You do not need to connect to the instance. Use Cloud Assistant in the ECS console to send remote commands to the instance to extend partitions and file systems.
      Important When you use Cloud Assistant, take note of the following limits:
      • Cloud Assistant is applicable to only specific users. If you can use Cloud Assistant, you are presented with the Cloud Assistant page in the ECS console.
      • Cloud Assistant commands can be run only on specific operating systems. For more information, see Overview.
      • You must first install Cloud Assistant on the ECS instance before you can use Cloud Assistant to extend partitions and file systems in the ECS console. For more information, see Install Cloud Assistant Agent.

      Click Run Preceding Command. In the Send Remote Commands dialog box, click Run. The system runs the command to extend partitions and file systems.

    Note If you use Logical Volume Manager (LVM) to manage your disk partitions, you must use LVM to extend the partitions and file systems after you resize your disk in the ECS console. For more information, see Extend an LV by using LVM.

FAQ

What do I do if I have resized a disk offline but do not want to restart the instance?

The offline disk resize operation takes effect only after you start or restart the instance. If you have resized a disk offline but cannot start or restart the instance due to your business requirements, you can resize the disk online again to make the offline resize operation take effect when the instance is in the Running state. You are charged for resizing the disk online. You must resize the disk based on your business requirements.

For example, assume that you have resized a disk of an instance to 60 GiB in the ECS console, but you do not want to restart the instance, the disk resizing does not take effect. You can resize the disk online again in the ECS console. For example, you can resize the disk to 61 GiB. After the disk is resized, you can see that the capacity of the disk is resized to 61 GiB in the operating system.

What do I do if the resize operation does not take effect on a disk for which the multi-attach feature is enabled?

After you resize a disk for which the multi-attach feature is enabled, the instances to which the disk is attached may not identify the new capacity. We recommend that you perform the following operations to complete the resize operation. For information about how to enable multi-attach, see Enable multi-attach.
  1. Detach the disk. For more information, see Detach a data disk.
  2. Re-attach the disk. For more information, see Attach a data disk.
  3. Optional: If the new capacity is still not identified after the disk is re-attached, we recommend that you restart the instances. For more information, see Restart instances.

Which instance types do not support online resizing of disks?

The following instance types do not support online resizing of disks:
  • ecs.ebmc4.8xlarge
  • ecs.ebmhfg5.2xlarge
  • ecs.ebmg5.24xlarge
  • ecs.t1
  • ecs.s1
  • ecs.s2
  • ecs.s3
  • ecs.c1
  • ecs.c2
  • ecs.m1
  • ecs.m2