Resizes a system disk or data disk.

Usage notes

Note Before you call this operation to resize a disk, you must check the partition format of the disk. A master boot record (MBR) disk cannot be resized to a size that is larger than 2 TiB. If you resize an MBR disk to a size that is larger than 2 TiB, data may be lost. If you want to resize an MBR disk to a size that is larger than 2 TiB, we recommend that you perform the following steps: Create another data disk that is larger than 2 TiB in size, partition and format the new data disk to a GUID partition table (GPT) disk, and then copy data from the MBR disk to the new GPT data disk. For more information, see Resize disks offline.
  • You can resize the following categories of disks: basic disks (cloud), ultra disks (cloud_efficiency), standard SSDs (cloud_ssd), and enhanced SSDs (ESSDs) (cloud_essd).
  • A disk cannot be resized when a snapshot is being created for the disk.
  • The instance to which the disk is attached must be in the Running (Running) or Stopped (Stopped) state.
  • After you resize a disk, its partitions and file systems are not changed. You must manually allocate the storage space on the disk after it is resized.
  • Disks for which the multi-attach feature is enabled can only be resized offline. Before you resize the disks, make sure that instances to which the disks are attached are in the Stopped (Stopped) state.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ResizeDisk

The operation that you want to perform. Set the value to ResizeDisk.

DiskId String Yes d-bp67acfmxazb4p****

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

Type String No offline

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

  • offline: resizes the disk offline. After you resize a disk offline, you must restart its associated instance by using the Elastic Compute Service (ECS) console or by calling the RebootInstance operation to make the resizing operation take effect. For information about how to restart an ECS instance in the ECS console, see Restart an instance.
  • online: resizes the disk online. After you resize a disk online, the resizing operation takes effect immediately and you do not need to restart the instance. You can resize ultra disks, standard SSDs, and ESSDs online.
NewSize Integer Yes 1900

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

  • For a system disk:
    • Basic disk (cloud): 20 to 500.
    • 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 capacity range depends on the value specified for the PerformanceLevel parameter. You can call the DescribeDisks operation to query disk information and check the value of the PerformanceLevel parameter in the response.
      • Valid values when the PerformanceLevel parameter is set to PL0: 40 to 32768.
      • Valid values when the PerformanceLevel parameter is set to PL1: 20 to 32768.
      • Valid values when the PerformanceLevel parameter is set to PL2: 461 to 32768.
      • Valid values when the PerformanceLevel parameter is set to PL3: 1261 to 32768.
    • Basic disk (cloud): 5 to 2000.

The new disk capacity must be greater than the original disk capacity.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Response parameters

Parameter Type Example Description
OrderId String 20413515388****

The ID of the order.

Note This parameter is returned only when a subscription disk is resized.
RequestId String F3CD6886-D8D0-4FEE-B93E-1B732396****

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ResizeDisk
&DiskId=d-bp67acfmxazb4p****
&NewSize=1900
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ResizeDiskResponse>
    <OrderId>20413515388****</OrderId>
    <RequestId>F3CD6886-D8D0-4FEE-B93E-1B732396****</RequestId>
</ResizeDiskResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode 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 error message returned because the specified DataDisk.N.Size parameter is invalid or because the snapshot size exceeds the maximum capacity allowed for the specified disk category.
400 InvalidDataDiskCategory.ValueNotSupported %s The error message returned because the specified disk category is invalid. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidParameter.Conflict %s The error message returned because a specified parameter is invalid. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidDataDiskSize.ValueNotSupported %s The error message returned because the specified data disk size is invalid. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidSystemDiskSize.ValueNotSupported %s The error message returned because the specified system disk size is invalid.
400 IncompleteParamter Some fields can not be null in this request. The error message returned because a required parameter is not specified.
400 InvalidParam.Type The specified type is not supported. The error message returned because the specified Type parameter is invalid.
400 LastOrderProcessing The previous order is still processing, please try again later. The error message returned because the order is being processed. Try again later.
400 InvalidSystemDiskSize.ImageNotSupportResize The specified image does not support resize. The error message returned because the specified image cannot be resized.
400 QuotaExceed.DiskCapacity The used capacity of disk type has exceeded the quota in the zone, %s. The error message returned because the used capacity of disks that belong to the specified disk category exceeds the quota limit for the zone. You can go to the Quota Center console to view and increase the disk capacity quota.
403 OperationDenied The type of the disk does not support the operation. The error message returned because the specified disk category does not support this operation.
403 OperationDenied The status of the disk or the instance that the disk is attaching with does not support the operation. The error message returned because the operation is not supported while the disk or instance is in the current state.
403 InvalidDiskSize.TooSmall Specified new disk size is less than the original disk size. The error message returned because the specified new disk capacity is smaller than the original disk capacity.
403 InvalidDiskSize.TooLarge Specified new disk size is beyond the permitted range. The error message returned because the specified new disk capacity exceeds the capacity limit.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). The error message returned because the subscription instance has expired. Renew the instance and try later.
403 DiskInArrears The specified operation is denied as your disk owing fee. The error message returned because you have an overdue payment for the specified disk.
403 IncorrectInstanceStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource is in the current state.
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet. The error message returned because a snapshot is being created for the specified disk.
403 InvalidDiskSize Specified new disk size is less than or equal the original disk size. The error message returned because the specified new disk capacity is smaller than or equal to the original disk capacity.
403 Operation.Conflict The operation may conflicts with others. The error message returned because the operation conflicts with other operations.
403 InstanceLockedForSecurity The instance is locked due to security. The error message returned because the operation is not supported while the instance is locked for security reasons.
403 IncorrectDiskStatus The current disk status does not support this operation. The error message returned because the operation is not supported while the disk is in the current state. Make sure that the disk is available and you have no overdue payments for the disk.
403 UserNotInTheWhiteList The user is not in disk white list. The error message returned because 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 error message returned because the specified disk category does not support the operation.
403 InvalidRegion.NotSupport The specified region does not support resize online. The error message returned because online resizing is not supported in the specified region.
403 InvalidDiskCategory.NotSupported The specified disk category does not support resize online. The error message returned because the specified disk category does not support online resizing.
403 IncorrectInstanceStatus The current status of the resource does not support resize online. The error message returned because the operation is not supported while the resource is in the current state.
403 InvalidInstanceStatus.NotRunning The status of instance to which the disk attachs must be running when resizing online. The error message returned because the instance to which the disk is attached is not in the Running state when you resize the disk online.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled. The error message returned because the customer master key (CMK) is not enabled when a Key Management Service (KMS) key ID is specified for a disk. You can call the DescribeKey operation of KMS to query the information of the specified CMK.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. The error message returned because ECS is not authorized to access your KMS resources.
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. The error message returned because risks are detected in your default credit card or debit card. Click the URL in the email for verification.
403 QuotaExceeded.PostpaidDataDiskCapacity The quota of postpaid data disk capacity exceeds. The error message returned because the capacity of pay-as-you-go data disks exceeds the quota limit.
403 InvalidOperation.MultiAttachDiskNotSupportResizeOnline Multi attach disk does not support resize online. The error message returned because the disk for which the multi-attach feature is enabled does not support online resizing.
404 InvalidDiskId.NotFound The specified disk does not exist. The error message returned because the specified disk does not exist. Check whether the specified disk ID is valid.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified instance does not exist. Check whether the specified instance ID is valid.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an internal error has occurred. Try again later.

For a list of error codes, see Service error codes.