You can call this operation to resize a system disk or data disk.

Description

Note Before you call this operation, you must check the partition format of the disk. If an existing partition of the disk is created by using MBR, you cannot resize the disk to greater than or equal to 2 TiB. Otherwise, data may be lost. In this case, we recommend that you create and attach another data disk. Format a GPT partition and copy the data in the MBR partition to the GPT partition. For more information, see Resize cloud disks offline.
  • The disks that can be resized include basic disks (cloud), ultra disks (cloud_efficiency), standard SSDs (cloud_ssd), and enhanced SSDs (cloud_essd).
  • You cannot resize a disk 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 will not be changed. You must manually allocate the storage space after resizing.

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
DiskId String Yes d-bp67acfmxazb4ph***

The ID of the disk.

NewSize Integer Yes 1900

The new disk capacity that you want to specify. Unit: GiB. Valid values:

  • Ultra disk (cloud_efficiency): 20 to 32768
  • Standard SSD (cloud_essd): 20 to 32768
  • Enhanced SSD (cloud_essd): 20 to 32768
  • Basic disk (cloud): 5 to 2000

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

Action String No ResizeDisk

The operation that you want to perform. If you use a custom HTTP URL or HTTPS URL to make an API request, you must specify the Action parameter. Set the value to ResizeDisk.

Type String No offline

The method used to resize the disk. Default value: offline. Valid values:

  • offline: After you resize a disk offline, you must restart the instance in the console or by calling the RebootInstance operation to validate the resizing operation.
  • online: After you resize a disk online, you do not need to restart the instance. You can resize ultra disks, standard SSDs, and enhanced SSDs online.
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 value, but you must ensure that it is unique among different requests. The ClientToken value can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Response parameters

Parameter Type Example Description
RequestId String F3CD6886-D8D0-4FEE-B93E-1B73239673DE

The ID of the request.

Examples

Sample requests

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

Sample success responses

XML format

<ResizeDiskResponse>
      <RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
</ResizeDiskResponse>

JSON format

{
	"RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
}

Error codes

HTTP status code Error code Error message Description
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. The error message returned because the maximum size of the specified data disk has been reached.
404 InvalidDiskId.NotFound The specified disk does not exist. The error message returned because the specified DiskId parameter does not exist. Check whether the disk ID is correct.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter does not exist. Check whether the instance ID is correct.
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 first.
403 DiskError IncorrectDiskStatus The error message returned because the specified DiskStatus parameter is invalid.
403 DiskInArrears The specified operation is denied as your disk owing fee. The error message returned because the disk has an overdue payment.
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.
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. If the problem persists, submit a ticket.
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.
400 InvalidDataDiskCategory.ValueNotSupported %s The error message returned because the specified data disk category is not supported.
400 InvalidParameter.Conflict %s The error message returned because the parameter conflicts with another parameter.
400 InvalidDataDiskSize.ValueNotSupported %s The error message returned because the specified data disk size is not supported.
400 InvalidSystemDiskSize.ValueNotSupported %s The error message returned because the specified system disk size is not supported.
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 the original disk capacity.
400 IncompleteParamter Some fields can not be null in this request. The error message returned because the required parameters are not specified.
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 resource 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. Ensure that the disk is available and has no overdue payments.
403 UserNotInTheWhiteList The user is not in disk white list. The error message returned because you are not authorized to use the specified disk.
400 InvalidRegionId.MalFormed The specified RegionId is not valid The error message returned because the specified RegionId parameter is invalid.
403 InvalidDiskCategory.NotSupported The specified disk category is not supported. The error message returned because the specified disk category is not supported.
400 InvalidParam.Type The specified type is not supported. The error message returned because the specified parameter is invalid.
403 InvalidRegion.NotSupport The specified region does not support resize online. The error message returned because online resizing is not available 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.
403 IncorrectDiskStatus The current status of the resource does not support resize online The error message returned because online resizing is not supported while the resource is in the current state.
400 LastOrderProcessing The previous order is still processing, please try again later. The error message returned because the previous order is being processed. Try again later.
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.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an unknown error has occurred.
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 your payment method has security risks. Troubleshoot the issue as instructed.
400 InvalidSystemDiskSize.ImageNotSupportResize The specified image does not support resize. The error message returned because the specified image does not support resizing.

For a list of error codes, visit the API Error Center.