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 I/O optimized and in the Running (Running) state.
    • 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. On the Resize Disks page, select Online Resizing and set the Size after Resize parameter.
    • Online Resizing: 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.
    • Offline Resizing: Clear Online Resizing in the Resizing Method column to use the offline resize method. 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 earlier instance type that does not support online resizing, use the offline resize method.
    The specified value of Size after Resize must be greater than the current capacity.
  5. Read and select ECS Service Terms, confirm the price, and then click Confirm.
  6. Read the notes, click I have read the notes. Resize, and then complete the payment.
    • If you resize the disk online, go to the Disks page to check whether the disk is resized.
    • If you resize the disk offline, proceed to the next step to restart the instance.
  7. Optional: Start or restart the instance. This step is applicable to only offline resizing.
    After you resize the disk offline, you must start or restart the instance by using the ECS console or by calling API operations for the new capacity to take effect.
    Important If you run the reboot command within the instance to restart the instance, the restart operation cannot take effect.
    1. Start or restart the instance based on the state of the instance.
    2. Check whether the disk is resized on the Disks page.
  8. Extend the partitions and file systems of the disk.
    After you resize the disk in the ECS console, the new capacity cannot be used. You must extend the partitions and file systems of the disk within the instance by using the new capacity to extend an existing partition or to create additional partitions. 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.
    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 Resize 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.