ResizeDisk

Updated at:

Resizes a system disk or a data disk.

Operation description

Note

扩容前,请务必查询云盘采用的分区格式。如果是 MBR 格式,不支持扩容到 2TiB 以上,否则会造成数据丢失。对于 MBR 分区扩容,建议您重新创建并挂载一块数据盘,采用 GPT 分区格式后,再将已有数据拷贝至新的数据盘上。更多详情,请参见扩容云盘容量

  • 支持扩容的磁盘类型包括普通云盘(cloud)、高效云盘(cloud_efficiency)、SSD 云盘(cloud_ssd)、ESSD 云盘(cloud_essd、ESSD Entry 云盘(cloud_essd_entry)、ESSD AutoPL 云盘(cloud_auto)、弹性临时盘-标准版(elastic_ephemeral_disk_standard)和弹性临时盘-高级版(elastic_ephemeral_disk_premium)、 ESSD 同城冗余云盘(cloud_regional_disk_auto)。

  • 正在创建快照的云盘不支持扩容。请您等待快照创建完成后,再开始执行扩容操作。

  • 该接口不能扩容分区和文件系统,您需要在扩容云盘容量后自行分配分区和文件系统,具体操作,请参见扩容分区与文件系统(Linux)扩容分区与文件系统(windows)

  • 开启多重挂载特性的云盘支持在线扩容和离线扩容,请确保磁盘挂载的实例满足以下条件:

    • 在线扩容时,实例状态为运行中Running)。

    • 离线扩容时,实例状态为运行中Running)或已停止Stopped)。

  • 请确保云盘满足以下条件:

    • 云盘状态为使用中(In Use)或者待挂载(Available)。

    • (强烈建议)已为云盘创建快照,做好数据备份。具体操作,请参见创建快照

    • 如果您是全新购买的数据盘,请先完成初始化再执行扩容操作。更多信息,请参见初始化概述

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ResizeDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

None None

Request parameters

Parameter

Type

Required

Description

Example

DiskId

string

Yes

The ID of the disk. You can call the DescribeDisks operation to query available disk IDs.

d-bp67acfmxazb4p****

Type

string

No

The method that you want to use to resize the disk. Valid values:

  • offline (default): resizes the disk offline. After resizing a disk offline, you must restart the instance in the console or call an API operation RebootInstance make the operation take effect.

  • online: resizes the disk online without the need to restart the instance. You can resize ultra disks, standard SSDs, ESSDs, and elastic ephemeral disks online.

offline

NewSize

integer

Yes

The new disk capacity. Unit: GiB. Valid values:

  • System disk:

    • Basic disk (cloud): 20 to 500.

    • ESSD (cloud_essd): The valid values vary based on the performance level of the ESSD.

      • Valid values when SystemDisk.PerformanceLevel is set to PL0: 1 to 2048.

      • Valid values when SystemDisk.PerformanceLevel is set to PL1: 20 to 2048.

      • Valid values when SystemDisk.PerformanceLevel is set to PL2: 461 to 2048.

      • Valid values when SystemDisk.PerformanceLevel is set to PL3: 1261 to 2048.

    • ESSD AutoPL disk: 1 to 2048.

    • Other disk categories: 20 to 2048.

  • Data disk:

    • Ultra disk (cloud_efficiency): 20 to 32768.

    • Standard SSD (cloud_ssd): 20 to 32768.

    • ESSD (cloud_essd): The valid values vary based on the performance level of the ESSD.`` To query the performance level of an ESSD, call the DescribeDisks operation to query disk information and check the PerformanceLevel value in the response.

      • PL0 ESSD: 1 to 65536.

      • PL1 ESSD: 20 to 65536.

      • PL2 ESSD: 461 to 65536.

      • PL3 ESSD: 1261 to 65536.

    • Basic disk (cloud): 5 to 2000.

    • ESSD AutoPL disk (cloud_auto): 1 to 65536.

    • Standard elastic ephemeral disk (elastic_ephemeral_disk_standard): 64 to 8192.

    • Premium elastic ephemeral disk (elastic_ephemeral_disk_premium): 64 to 8192.

Note

The new disk capacity must be larger than the original disk capacity. Otherwise, an error is reported.

1900

ClientToken

string

No

The new disk capacity. Unit: GiB. Valid values:

  • For a system disk:

    • Basic disk (cloud): 20 to 500.

    • ESSD (cloud_essd): The valid values vary based on the performance level of the ESSD.

      • PL0 ESSD: 1 to 2048.

      • PL1 ESSD: 20 to 2048.

      • PL2 ESSD: 461 to 2048.

      • PL3 ESSD: 1261 to 2048.

    • ESSD AutoPL disk: 1 to 2048.

    • Other disk categories: 20 to 2048.

  • For a data disk:

    • Ultra disk (cloud_efficiency): 20 to 32768.

    • Standard SSD (cloud_ssd): 20 to 32768.

    • ESSD (cloud_essd): The valid values vary based on the performance level of the ESSD.`` To query the performance level of an ESSD, call the DescribeDisks operation to query disk information and check the PerformanceLevel value in the response.

      • PL0 ESSD: 1 to 65536.

      • PL1 ESSD: 20 to 65536.

      • PL2 ESSD: 461 to 65536.

      • PL3 ESSD: 1261 to 65536.

    • Basic disk (cloud): 5 to 2000.

    • ESSD AutoPL disk (cloud_auto): 1 to 65536.

    • Standard elastic ephemeral disk (elastic_ephemeral_disk_standard): 64 to 8192.

    • Premium elastic ephemeral disk (elastic_ephemeral_disk_premium): 64 to 8192.

Note

The new disk capacity must be larger than the original disk capacity. Otherwise, an error is reported.

123e4567-e89b-12d3-a456-426655440000

Response elements

Element

Type

Description

Example

object

OrderId

string

The ID of the request.

20413515388****

RequestId

string

The ID of the request.

F3CD6886-D8D0-4FEE-B93E-1B732396****

Examples

Success response

JSON format

{
  "OrderId": "20413515388****",
  "RequestId": "F3CD6886-D8D0-4FEE-B93E-1B732396****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidDataDiskSize.ValueNotSupported The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category. The specified DataDisk.N.Size parameter is invalid or the snapshot size exceeds the maximum capacity allowed for the specified disk category.
400 InvalidParameter.Conflict %s The specified parameter is invalid. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions.
400 IncompleteParamter Some fields can not be null in this request. Some required parameters are not specified.
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
400 InvalidParam.Type The specified type is not supported. The specified Type parameter is invalid.
400 LastOrderProcessing The previous order is still processing, please try again later. The order is being processed. Try again later.
400 InvalidStatus.Upgrading The instance which the disk attachs is upgrading; please try again later.
400 InvalidSystemDiskSize.ImageNotSupportResize The image of the instance does not support resize.
400 InvalidDisk.DetachedSystemDisk The specified disk is a detached system disk, does not support this operation.
400 OperationDenied.NotEnoughCapacity The capacity of the current dedicated block storage cluster is not enough to expand.
400 IncorrectDiskStatus.ReplicationStatusNotFound Disk replication status not found.
400 IncorrectDiskStatus.InReplication Disk already in replication.
400 QuotaExceed.DiskCapacity The used capacity of disk type has exceeded the quota in the zone, %s. The capacity of disks that belong to the specified disk category exceeds the quota limit for the zone.
400 NoPermission.Price The operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true. This operation requires price permission. Please apply for permission to your master account, or set the parameter AutoPay to true for automatic payment.
400 NoPermission.Refund The operation requires refund permission. Please apply for permission from your main account. This account does not have permission to operate refund, and the main account needs to authorize refund-related permissions.
400 InvalidOperation.InstanceRenewWithDowngradeInPlan The operation is denied due to the specified instance has renew with downgrade record in plan. There are renewal downgrade orders that have not yet taken effect. This operation is not allowed before the order takes effect.
400 InvalidSystemDiskSize.ValueNotSupported The specified system disk size is invalid. The specified system disk size is invalid.
400 OperationDenied.UnfinishedOrder The current instance has unfinished refundOrder, this operation is denied.
400 AccountForbidden.CreateOrder Order cannot be created due to abnormal account.
500 InternalError The request processing has failed due to some unknown error.
403 InvalidDataDiskSize.ValueNotSupported The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category.
403 OperationDenied The type of the disk does not support the operation. The disk category does not support the specified operation.
403 InvalidDiskSize.TooSmall Specified new disk size is less than the original disk size.
403 InvalidDiskSize.TooLarge Specified new disk size is beyond the permitted range.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 DiskError Incorrect disk status.
403 DiskInArrears The specified operation is denied as your disk owing fee.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet.
403 InvalidDiskSize Specified new disk size is less than or equal the original disk size. The new disk size must be greater than the original disk size.
403 Operation.Conflict The operation may conflicts with others.
403 InstanceLockedForSecurity The instance is locked due to security. The operation is not supported while the instance is locked for security reasons.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 UserNotInTheWhiteList The user is not in disk white list. You are not authorized to manage the disk. Try again when you are authorized.
403 InvalidDiskCategory.NotSupported The specified disk category is not supported. The specified disk category does not support this operation.
403 InvalidRegion.NotSupport The specified region does not support resize online. Online resizing is not supported in the region.
403 InvalidInstanceStatus.NotRunning The status of instance to which the disk attachs must be running when resizing online. The instance to which the disk is attached is not in the Running state when you resize the disk online.
403 InvalidOperation.InstanceTypeNotSupportOnlineResize The instance type of the specified instance does not support resize online.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. ECS is not authorized to access your KMS resources.
403 InstanceSpecModification.NotEffective The instance which the disk attachs has been reserved for making a spec modification and not taken effective in the current contract period.
403 InvalidDiskSize.NotSupportResizeOnline The current size of the resource does not support resize online.
403 SecurityRisk.3DVerification We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.
403 QuotaExceeded.PostpaidDataDiskCapacity The quota of postpaid data disk capacity exceeds. The used capacity of the pay-as-you-go disk reaches the quota limit.
403 InvalidOperation.MultiAttachDiskNotSupportResizeOnline Multi attach disk does not support resize online. Disks for which the multi-attach feature is enabled cannot be resized online.
403 InvalidDataDiskCategory.ValueNotSupported The specified Category of Data Disk is not valid. The specified data disk type is not supported.
403 InvalidDiskSize.NotSupportMultiAttachDisk The specified disk size exceeds the maximum limit 65536 for enabling multi-attach. The specified disk size exceeds the maximum limit 65536 for enabling multi-attach.
404 InvalidDiskId.NotFound The specified disk does not exist. The specified disk does not exist. Check whether the disk ID is correct.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The specified instanceId is invalid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.