Restores a disk from a snapshot of the disk.
Description
When you call this operation, take note of the following items:
- The disk must be in the In Use (In_Use) or Unattached (Available) state.
- The Elastic Compute Service (ECS) instance to which the disk is attached must be in the Stopped (Stopped) state. You can call the StopInstances operation to stop an instance.
- The snapshot specified by the SnapshotId parameter must be created from the disk specified by the DiskId parameter.
- When you call the DescribeInstances operation to query instance information, if the response contains
{"OperationLocks": {"LockReason" : "security"}}
for an instance, the instance is locked for security reasons and no operations can be performed on the instance.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ResetDisk |
The operation that you want to perform. Set the value to ResetDisk. |
DiskId | String | Yes | d-bp199lyny9b3**** |
The ID of the disk that you want to restore. |
SnapshotId | String | Yes | s-bp199lyny9b3**** |
The ID of the snapshot that you want to use to restore the disk. |
DryRun | Boolean | No | false |
Specifies whether to check the validity of the request without actually making the request. Valid values:
Default value: false. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | F3CD6886-D8D0-4FEE-B93E-1B732396**** |
The ID of the request. |
Examples
Sample requests
http(s)://ecs.aliyuncs.com/?Action=ResetDisk
&DiskId=d-bp199lyny9b3****
&SnapshotId=s-bp199lyny9b3****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ResetDiskResponse>
<RequestId>F3CD6886-D8D0-4FEE-B93E-1B732396****</RequestId>
</ResetDiskResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "F3CD6886-D8D0-4FEE-B93E-1B732396****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | DiskCategory.OperationNotSupported | The operation is not supported to the specified disk due to its disk category | The error message returned because the specified disk category does not support this operation. |
400 | InvalidRegionId.MalFormed | The specified RegionId is not valid | The error message returned because the specified RegionId parameter is invalid. |
400 | DryRunOperation | Request validation has been passed with DryRun flag set. | The error message returned because your request is determined as valid when the DryRun parameter is set to true. |
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 usable and you have no overdue payments for it. |
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 | 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 | InvalidParameter.Mismatch | The specified snapshot is not created from the specified disk. | The error message returned because an encrypted snapshot cannot be used to restore an unencrypted disk. |
403 | InvalidSnapshot.TooOld | The snapshotId is created before 2013-07-15, it cannot be restored since the first time the disk detached. | The error message returned because snapshots created before July 15, 2013 do not support this operation. |
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 again. |
403 | OperationDenied | The specified snapshot dees not support ResetDisk. | The error message returned because the specified snapshot does not support this operation. |
403 | InvalidSnapshotId.NotReady | The specified snapshot has not completed yet. | The error message returned because the specified snapshot is being created. |
403 | InvalidAccountStatus.NotEnoughBalance | Your account does not have enough balance. | The error message returned because your account balance is insufficient. Add funds to your account and try again. |
403 | InvalidAccountStatus.SnapshotServiceUnavailable | Snapshot service has not been opened yet. | The error message returned because the operation is not supported while the snapshot service is not activated. |
403 | Operation.Conflict | The operation may conflicts with others. | The error message returned because the operation conflicts with other operations. |
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 | 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 the disk. You can call the DescribeKey operation of KMS to query information about 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. |
404 | InvalidParameter.KMSKeyId.NotFound | The specified KMSKeyId does not exist. | The error message returned because the specified KMS key ID does not exist. |
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 | Disk.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 | InvalidSnapshotId.NotFound | The specified SnapshotId does not exist. | The error message returned because the specified SnapshotId parameter does not exist. |
404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | The error message returned because the specified instance does not exist. Check whether the instance ID is correct. |
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, visit the API Error Center.