All Products
Search
Document Center

Elastic Compute Service:Step 1: Resize a disk to extend the capacity of the disk

Last Updated:Nov 15, 2024

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 to make the new disk size take effect. After you resize a disk offline, you must restart the associated instance to make the new disk size take effect.

Limits

  • You cannot resize a disk for which a snapshot is being created. Wait until the snapshot is created before you resize the disk.

  • You cannot resize local disks.

    Do not resize local disks. If you resize local disks, the partition table and file system structure on the disks may be corrupted, which affects business continuity.

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 (Running) state.

    • If you want to resize the disk offline, the instance is in the Running (Running) or Stopped (Stopped) state.

  • The disk that you want to resize meets the following requirements:

    • The disk is in the In Use (In Use) or Unattached (Unattached) state.

      Note

      After you resize the disk, you must extend the partitions and file systems of the disk in the operating system of the instance. If the disk is in the Unattached state, attach the disk to an instance before you extend the partitions and file systems of the disk.

    • (Recommended) Snapshots are created for the disk to back up data. For more information, see Create a snapshot for a disk.

      Note

      You are charged for snapshots. For more information, see Billing of snapshots.

    • If the disk is a new data disk, initialize the disk before you resize the disk. For more information, see Overview.

Procedure

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Storage & Snapshots > Block Storage.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. 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 更多 > Resize 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.

  5. In the Determine Disk and Read Notes step, click I Understand Risks and Have Backed Up Data. Proceed.

  6. In the Configure Resizing Method and New Size step, configure the parameters.

    image

    1. Configure the New Disk Size parameter. The value cannot be smaller than the current disk size.

    2. 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.

        Note

        After you resize a disk attached to an instance offline, you must restart the instance for the new disk size to take effect. If 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.

        Note

        The offline resizing method is suitable for the following scenarios:

        • If the instance is in the Stopped state or the instance type does not support the online resizing of disks, you can resize disks only offline. For information about the instance types that do not support the online resizing of disks, see the FAQ section of this topic.

        • If the 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 more information, see Update the Red Hat virtio driver on a Windows instance.

    3. Read the ECS Terms of Service and select I have read and agree to ECS Terms of Service.

    4. In the lower-left corner of the Resize Cloud Disk page, confirm the price and click OK.

  7. In the Confirm Resizing Results step, click Next Step: Extend Partitions and File Systems in the lower-left corner of the Resize Cloud Disk page if Successful is displayed in the Resizing Result column.

    image

  8. Follow the on-screen instructions to extend the partitions and file systems of the disk by using Cloud Assistant or by referring to the documentation.

    Why am I unable to extend partitions and file systems on the disk by using Cloud Assistant?

    • Cloud Assistant is available only to specific users. If the Cloud Assistant tab is displayed on the Resize Cloud Disk page, you can use Cloud Assistant.

    • The instance to which the disk is attached is in the Running state. Cloud Assistant Agent is installed on the instance. For more information, see Install Cloud Assistant Agent.

    • Cloud Assistant commands can run only on specific operating systems. For more information, see Overview of Cloud Assistant.

    Use Cloud Assistant

    1. (Conditionally required) If you resized a disk offline, click Restart Instance in the Solution section to restart the instance to which the disk is attached to make the new disk size take effect.

      image

    2. On the Cloud Assistant tab click Run Preceding Command in the Solution section. 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.

      image

    Refer to documentation (CLI)

    1. (Conditionally required) If you resized a disk offline, you must restart the instance to which the disk is attached in the ECS console or by calling an API operation to make the new disk size 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.

    2. Connect to the instance and run CLI commands in the operating system to extend the partitions and file systems of the disk. For more information, see Extend the partitions and file systems of disks on a Linux instance or Extend the partitions and file systems of disks on Windows instances.

FAQ

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

The new disk size takes effect only after you start or restart the associated instance. If you resized a disk offline but you cannot start or restart the instance due to your business requirements, you can resize the disk online to make the offline resize operation take effect. You are charged when you resize a disk online. Resize a disk based on your business requirements.

For example, you resize a disk to 60 GiB offline in the ECS console, but you do not want to restart the associated instance. The offline resize operation does not take effect. You can resize the disk online in the ECS console. For example, you can resize the disk to 61 GiB online. After you resize the disk online, the disk capacity is increased to 61 GiB in the operating system.

What do I do if the new disk size 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, all instances to which the disk is attached may not immediately recognize the new disk size. After you resize a disk, we recommend that you perform the following operations:

  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. (Conditionally required) If the new disk size is still not recognized by specific instances after you re-attach the disk, we recommend that you restart the instances to which is disk is attached. For more information, see Restart an instance.

For information about the multi-attach feature, see Multi-attach for cloud disks.

Which instance types do not support the online resizing of disks?

The following instance types do not support the 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