All Products
Search
Document Center

Elastic Compute Service:ReInitDisk

Last Updated:May 16, 2024

Re-initializes a disk to the state that it was in when it was created.

Operation description

When you call this operation, take note of the following points:

  • The disk that you want to re-initialize must be in the In Use (In_use) state and the instance to which the disk is attached must be in the Stopped (Stopped) state.
  • If the instance has never been started since it was created, the disks attached to it cannot be re-initialized.
  • If a local snapshot has been created for a disk, the disk cannot be re-initialized.
  • When a system disk is re-initialized, it is restored to the state of the image from which it was created. If the source image is deleted, the system disk cannot be re-initialized.
  • When a separately created data disk is re-initialized, it is restored to an empty data disk.
  • When a data disk that was created from a snapshot is re-initialized, the disk is restored to the state of the snapshot.
Note If the source snapshot is deleted, the disk cannot be re-initialized and an error is returned.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringYes

The ID of the disk.

d-bp67acfmxazb4ph****
PasswordstringNo

Specifies whether to reset the password of the instance when you re-initialize its system disk. The password must be 8 to 30 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include:

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/

For Windows instances, passwords cannot start with a forward slash (/).

Note If the Password parameter is specified, we recommend that you send requests over HTTPS to prevent password leaks.
EcsV587!
KeyPairNamestringNo

The name of the key pair. This parameter is empty by default.

Note The parameter is applicable only to Linux instances. You can bind an SSH key pair to an instance as the logon credential when you re-initialize the system disk of the instance. After the SSH key pair is bound, the username and password-based logon method is disabled for the instance.
testKeyPairName
AutoStartInstancebooleanNo

Specifies whether to automatically start the instance after the disk is re-initialized.

Default value: false.

true
SecurityEnhancementStrategystringNo

Specifies whether to use Security Center for free after the system disk is re-initialized. Valid values:

  • Active: Security Center is activated for free after the system disk is replaced. This value is applicable to only public images.
  • Deactive: Security Center is not activated after the system disk is replaced. This value is applicable to all images.

Default value: Deactive.

Active

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
400LoginAsNonRoot.ImageNotSupportThe specified image does not support login as non-root.The image does not support the logons of non-root users.
400DiskHasSnapshotsWithInstantAccessEnabled.OperationNotSupportedThe operation is not supported to the specified disk that have snapshots with InstantAccess enabled.-
400InvalidPassword.MalformedThe specified parameter "Password" is not valid.-
400InvalidKeyPairName.NotFoundThe specified KeyPairName does not exist.The specified KeyPairName parameter does not exist.
400DependencyViolation.IoOptimizeThe specified parameter InstanceId is not valid.The I/O optimization configuration of the instance is invalid.
400DiskCategory.OperationNotSupportedThe operation is not supported to the specified disk due to its disk category.The specified disk category does not support this operation.
400InvalidRegionId.MalFormedThe specified RegionId is not valid.The specified region does not exist.
403LoginAsNonRoot.RegionNotSupportThe specified region does not support login as non-root.-
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.
403IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403InstanceLockedForSecurityThe instance is locked due to security.The operation is not supported while the instance is locked for security reasons.
403InvalidSnapshot.TooOldThe disk is created from a snapshotId made before 2013-07-15, it cannot be re-initiated the specified disk any more since the detached first time.Snapshots created before July 15, 2013 do not support this operation.
403OperationDeniedThe snapshot which is used to create the specified disk has been deleted.The snapshot used to create the specified disk does not exist.
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.
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.
403InvalidSourceSnapshotThe snapshot which is used to create the specified disk has been deleted.The snapshot used to create the specified disk has been deleted.
403SharedImageDeletedThe specified image by others shared is deleted.The specified shared image has been deleted.
403DependencyViolation.WindowsInstanceThe instance creating is windows, cannot use ssh key pair to login.-
403UserNotInTheWhiteListThe user is not in volume white list.You are not authorized to manage the Shared Block Storage device. Submit a ticket to apply for the permissions.
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.
403HibernationConfigured.InstanceOperationForbiddenThe operation is not permitted due to limit of the hibernation configured instance.The operation cannot be performed due to the limitations of instances for which the instance hibernation feature is enabled.
403InvalidOperation.MultiAttachDiskMulti attach disk does not support this operation.Disks for which the multi-attach feature is enabled do not support the operation.
403InvalidParameter.KMSKeyId.CMKUnauthorizedThe CMK needs to be added ECS tag.-
404InvalidDiskId.NotFoundThe specified disk does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404InvalidImageId.NotFoundThe specified ImageId does not exist.The specified image does not exist in this account. Check whether the image ID is correct.
404InvalidDiskId.OperationNotSupportedThe operation is not supported due to image not exist.-
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
2023-08-25The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500
2021-06-18The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500