All Products
Search
Document Center

Elastic Compute Service:ResizeDisk

更新時間:Dec 24, 2024

Resizes a system disk or a data disk.

Operation description

Note Before you call this operation to resize a disk, you must check the partition format of the disk. You cannot resize a master boot record (MBR) disk 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 a new data disk that is larger than 2 TiB in size, partition and format the new data disk by using the GUID Partition Table (GPT) format, and then copy data from the MBR disk to the GPT data disk. For more information, see Step 1: Resize a disk to extend the capacity of the disk.
  • You can resize disks of the following disk categories: basic disks (cloud), ultra disks (cloud_efficiency), standard SSDs (cloud_ssd), Enterprise SSDs (ESSDs) (cloud_essd), ESSD AutoPL disks (cloud_auto), standard elastic ephemeral disks (elastic_ephemeral_disk_standard), and premium elastic ephemeral disks (elastic_ephemeral_disk_premium).

  • 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 call this operation to resize partitions or file systems on a disk. You must manually resize the partitions and file systems after the disk is resized. For more information, see Step 2: Resize partitions and file systems.

  • If the multi-attach feature is enabled for a disk, you can resize the disk online or offline. Make sure that the Elastic Compute Service (ECS) instances to which the disk is attached meet the following requirements:

    • If you want to resize the disk online, the ECS instances must be in the Running (Running) state.
    • If you want to resize the disk offline, the ECS instances must be in the Running (Running) or Stopped (Stopped) state.
  • The disk that you want to resize must meet the following requirements:

    • The disk is in the In_use (In Use) or Available (Unattached) state.
    • (Recommended) Snapshots are created for the disk to back up disk data. For information about how to create snapshots for a disk, see Create a snapshot.
    • If the disk is a new data disk, initialize the disk before you resize the disk. For more information, see Overview .

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ResizeDiskupdate
*Disk
acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringYes

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

d-bp67acfmxazb4p****
TypestringNo

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 the ECS instance to which the disk is attached in the ECS console or by calling the RebootInstance operation to allow the resizing operation to take effect. For information about how to restart an ECS instance in the ECS console, see Restart an ECS instance.
  • online: resizes the disk online. After you resize a disk online, the resizing operation immediately takes effect. You do not need to restart the ECS instance to which the disk is attached. You can resize ultra disks, standard SSDs, Enterprise SSDs (ESSDs), and elastic ephemeral disks online.
offline
NewSizeintegerYes

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. 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 2048.
      • PL1 ESSD: 20 to 2048.
      • PL2 ESSD: 461 to 2048.
      • PL3 ESSD: 1261 to 2048.
    • ESSD AutoPL disk (cloud_auto): 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
ClientTokenstringNo

The ID of the order.

Note This parameter is returned only when you resize subscription disks.
123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object
OrderIdstring

The ID of the request.

20413515388****
RequestIdstring

The ID of the request.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidDataDiskSize.ValueNotSupportedThe 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.
400InvalidDataDiskCategory.ValueNotSupported%s-
400InvalidParameter.Conflict%sThe specified parameter is invalid. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions.
400InvalidDataDiskSize.ValueNotSupported%s-
400InvalidSystemDiskSize.ValueNotSupported%sThe specified system disk size is invalid.
400IncompleteParamterSome fields can not be null in this request.Some required parameters are not specified.
400InvalidRegionId.MalFormedThe specified RegionId is not valid.The specified region does not exist.
400InvalidParam.TypeThe specified type is not supported.The specified Type parameter is invalid.
400LastOrderProcessingThe previous order is still processing, please try again later.The order is being processed. Try again later.
400InvalidStatus.UpgradingThe instance which the disk attachs is upgrading; please try again later.-
400InvalidSystemDiskSize.ImageNotSupportResizeThe image of the instance does not support resize.-
400InvalidSystemDiskSize.ImageNotSupportResizeThe specified image does not support resize.The specified image does not support resizing.
400InvalidDisk.DetachedSystemDiskThe specified disk is a detached system disk, does not support this operation.-
400OperationDenied.NotEnoughCapacityThe capacity of the current dedicated block storage cluster is not enough to expand.-
400IncorrectDiskStatus.ReplicationStatusNotFoundDisk replication status not found.-
400IncorrectDiskStatus.InReplicationDisk already in replication.-
400QuotaExceed.DiskCapacityThe 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.
400NoPermission.PriceThe operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.-
400NoPermission.RefundThe operation requires refund permission. Please apply for permission from your main account.-
400InvalidOperation.InstanceRenewWithDowngradeInPlanThe 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.
403OperationDeniedThe type of the disk does not support the operation.The disk category does not support the specified operation.
403OperationDeniedThe status of the disk or the instance that the disk is attaching with does not support the operation.The disk or instance is in a state that does not support the current operation.
403InvalidDiskSize.TooSmallSpecified new disk size is less than the original disk size.The specified new disk capacity is smaller than the original disk capacity.
403InvalidDiskSize.TooLargeSpecified new disk size is beyond the permitted range.The size of the new disk is beyond the permitted range.
403InstanceExpiredOrInArrearsThe specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).The subscription instance has expired. You must renew the instance before you can proceed.
403DiskErrorIncorrect disk status.-
403DiskInArrearsThe specified operation is denied as your disk owing fee.Your account has overdue payments for the specified disk.
403IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403DiskCreatingSnapshotThe operation is denied due to a snapshot of the specified disk is not completed yet.A snapshot is being created for the specified disk.
403InvalidDiskSizeSpecified new disk size is less than or equal the original disk size.The new disk size must be greater than the original disk size.
403Operation.ConflictThe operation may conflicts with others.The operation conflicts with other operations.
403InstanceLockedForSecurityThe instance is locked due to security.The operation is not supported while the instance is locked for security reasons.
403IncorrectDiskStatusThe current disk status does not support this operation.The disk is in a state that does not support the current operation. Make sure that the disk is available and that your account has no overdue payments.
403UserNotInTheWhiteListThe user is not in disk white list.You are not authorized to manage the disk. Try again when you are authorized.
403InvalidDiskCategory.NotSupportedThe specified disk category is not supported.The specified disk category does not support this operation.
403InvalidRegion.NotSupportThe specified region does not support resize online.Online resizing is not supported in the region.
403InvalidDiskCategory.NotSupportedThe specified disk category does not support resize online.-
403IncorrectInstanceStatusThe current status of the resource does not support resize online.-
403InvalidInstanceStatus.NotRunningThe 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.
403IncorrectDiskStatusThe current status of the resource does not support resize online.-
403InvalidOperation.InstanceTypeNotSupportOnlineResizeThe instance type of the specified instance does not support resize online.-
403InvalidParameter.KMSKeyId.CMKUnauthorizedThe CMK needs to be added ECS tag.-
403InvalidParameter.KMSKeyId.CMKNotEnabledThe CMK needs to be enabled.The customer master key (CMK) is not enabled when KMSKeyId is specified for an encrypted disk. You can call the DescribeKey operation of KMS to query information about the specified CMK.
403InvalidParameter.KMSKeyId.KMSUnauthorizedECS service have no right to access your KMS.ECS is not authorized to access your KMS resources.
403InstanceSpecModification.NotEffectiveThe instance which the disk attachs has been reserved for making a spec modification and not taken effective in the current contract period.-
403InvalidDiskSize.NotSupportResizeOnlineThe current size of the resource does not support resize online.-
403SecurityRisk.3DVerificationWe have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.-
403QuotaExceeded.PostpaidDataDiskCapacityThe quota of postpaid data disk capacity exceeds.The used capacity of the pay-as-you-go disk reaches the quota limit.
403InvalidOperation.MultiAttachDiskNotSupportResizeOnlineMulti attach disk does not support resize online.Disks for which the multi-attach feature is enabled cannot be resized online.
404InvalidDiskId.NotFoundThe specified disk does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-04API Description Update. The Error code has changedView Change Details
2024-08-23The Error code has changedView Change Details
2023-10-18The Error code has changedView Change Details
2023-10-09The Error code has changedView Change Details
2023-05-16The Error code has changedView Change Details