All Products
Search
Document Center

:ResizeDisk

更新时间:Dec 25, 2023

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), enhanced SSDs (ESSDs) (cloud_essd), and ESSD AutoPL disks (cloud_auto).
  • 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 support online resizing and offline resizing. Before you resize the disks, make sure that the 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. Valid values:

  • offline (default): 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): Valid values depend on the PerformanceLevel value. You can call the DescribeDisks operation to query disk information and check the PerformanceLevel value in the response.
      • Valid values when PerformanceLevel is set to PL0: 40 to 32768.
      • Valid values when PerformanceLevel is set to PL1: 20 to 32768.
      • Valid values when PerformanceLevel is set to PL2: 461 to 32768.
      • Valid values when PerformanceLevel is set to PL3: 1261 to 32768.
    • Basic disk (cloud): 5 to 2000.
    • ESSD AutoPL disk (cloud_auto): 40 to 32768.

The new disk capacity must be larger 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

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 DataDisk.N.Size parameter is invalid, or the snapshot size exceeds the maximum capacity allowed for the specified disk category.
400 InvalidDataDiskCategory.ValueNotSupported %s Invalid DataDiskCategory value. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidParameter.Conflict %s 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 Invalid DataDiskSize value. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidSystemDiskSize.ValueNotSupported %s Invalid SystemDisk.Size value.
400 IncompleteParamter Some fields can not be null in this request. A required parameter is not specified.
400 InvalidRegionId.MalFormed The specified RegionId is not valid. Invalid RegionId value.
400 InvalidParam.Type The specified type is not supported. Invalid Type value.
400 LastOrderProcessing The previous order is still processing, please try again later. The order is being processed. Try again later.
400 InvalidSystemDiskSize.ImageNotSupportResize The specified image does not support resize. The specified image does not support resizing.
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. You can go to the Quota Center to view and increase the quota.
400 InvalidOperation.InstanceRenewWithDowngradeInPlan The operation is denied due to the specified instance has renew with downgrade record in plan. Renewal and configuration downgrade orders did not take effect. This operation cannot be performed before the order takes effect.
403 OperationDenied The type of the disk does not support the operation. The 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 operation cannot be performed on the disk or instance in the current state.
403 InvalidDiskSize.TooSmall Specified new disk size is less than the original disk size. The specified new disk capacity is less than the original disk capacity.
403 InvalidDiskSize.TooLarge Specified new disk size is beyond the permitted range. The specified new disk size is out of range.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). The instance has expired or has an overdue payment. Renew or complete payment for the instance before you proceed.
403 DiskInArrears The specified operation is denied as your disk owing fee. You have an overdue payment for the specified disk.
403 IncorrectInstanceStatus The current status of the resource does not support this operation. The operation cannot be performed on the resource in the current state.
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet. 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 new disk size must be larger than the original disk size.
403 Operation.Conflict The operation may conflicts with others. The operation conflicts with other operations.
403 InstanceLockedForSecurity The instance is locked due to security. This operation cannot be performed on the resource that is locked for security reasons.
403 IncorrectDiskStatus The current disk status does not support this operation. This operation cannot be performed on the disk in the current state. Make sure that the disk is available and you have no overdue payments for it.
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 InvalidDiskCategory.NotSupported The specified disk category does not support resize online. The specified disk category does not support online resizing.
403 IncorrectInstanceStatus The current status of the resource does not support resize online. This operation cannot be performed on the resource in the current state.
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 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag. You are not authorized to use the customer master key (CMK).
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled. The CMK is not enabled when the ID of the CMK is specified for a disk. You can call the DescribeKey operation of Key Management Service (KMS) to query the information about the specified CMK.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. 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. 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 capacity of pay-as-you-go data disks exceeds the quota limit.
403 InvalidOperation.MultiAttachDiskNotSupportResizeOnline Multi attach disk does not support resize online. 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 specified disk is not found. Check whether the specified disk ID is valid.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The instance is not found. Check whether the instance ID is correct.
500 InternalError The request processing has failed due to some unknown error. An internal error occurred. Try again later.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error occurred. Try again later.

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