Reinitializes a disk to its initial state at creation.
Operation description
When you call this operation, take note of the following items:
The disk must be in the In Use (
In_use) state, and the ECS instance to which the disk is attached must be in the Stopped (Stopped) state.You cannot reinitialize a disk attached to an instance before the instance is started for the first time.
You cannot reinitialize a disk for which local snapshots exist.
For a system disk, the disk is reinitialized to the initial state of the image. If the source image from which the disk was created is deleted, the disk cannot be reinitialized.
For a data disk created directly, the disk is reinitialized to an empty state. For a data disk created from a snapshot, the disk is reinitialized to the state of the snapshot. If the source snapshot is deleted, the disk cannot be reinitialized and an error is returned.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ReInitDisk |
update |
*Disk
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DiskId |
string |
Yes |
The ID of the disk to be reinitialized. The instance to which the disk is attached must have been started at least once and must be in the Stopped state. |
d-bp67acfmxazb4ph**** |
| Password |
string |
No |
Specifies whether to reset the logon password of the ECS instance when you reinitialize the 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. The special characters can be:
For Windows instances, the password cannot start with a forward slash (/). Note
If you specify the |
EcsV587! |
| KeyPairName |
string |
No |
The name of the key pair. Note
This parameter is applicable only to Linux instances. When you reinitialize the system disk, you can bind an SSH key pair to the ECS instance as a logon credential. After an SSH key pair is used, the password logon method is disabled. |
testKeyPairName |
| AutoStartInstance |
boolean |
No |
Specifies whether to automatically start the instance after the disk is reinitialized. Valid values:
Default value: false. |
true |
| SecurityEnhancementStrategy |
string |
No |
Specifies whether to use Security Center for free after the specified system disk is reinitialized. Valid values:
Default value: Deactive. |
Active |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | LoginAsNonRoot.ImageNotSupport | The specified image does not support login as non-root. | The image does not support the logons of non-root users. |
| 400 | DiskHasSnapshotsWithInstantAccessEnabled.OperationNotSupported | The operation is not supported to the specified disk that have snapshots with InstantAccess enabled. | |
| 400 | InvalidPassword.Malformed | The specified parameter "Password" is not valid. | The specified Password parameter is invalid. |
| 400 | InvalidKeyPairName.NotFound | The specified KeyPairName does not exist. | The specified KeyPairName parameter does not exist. |
| 400 | DependencyViolation.IoOptimize | The specified parameter InstanceId is not valid. | The I/O optimization configuration of the instance is invalid. |
| 400 | DiskCategory.OperationNotSupported | The operation is not supported to the specified disk due to its disk category. | The specified disk category does not support this operation. |
| 400 | InvalidRegionId.MalFormed | The specified RegionId is not valid. | |
| 500 | InternalError | The request processing has failed due to an internal error and you may retry later or contact support with the request ID. | |
| 403 | LoginAsNonRoot.RegionNotSupport | The specified region does not support login as non-root. | |
| 403 | IncorrectDiskStatus | The current disk status does not support this operation. | |
| 403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | |
| 403 | InstanceLockedForSecurity | The instance is locked due to security. | The operation is not supported while the instance is locked for security reasons. |
| 403 | InvalidSnapshot.TooOld | The disk was created from a snapshot taken before 2013-07-15 and can no longer be reinitialized. | |
| 403 | OperationDenied | The snapshot which is used to create the specified disk has been deleted. | |
| 403 | InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | |
| 403 | DiskCreatingSnapshot | The operation is denied due to a snapshot of the specified disk is not completed yet. | |
| 403 | SharedImageDeleted | The specified image by others shared is deleted. | |
| 403 | DependencyViolation.WindowsInstance | The instance runs Windows and does not support SSH key pair login. | |
| 403 | InvalidDisk.DiskFromClonedNotSupport | The specified disk %s was cloned from source disk %s. Reinitialization is not supported for cloned disks. | |
| 403 | UserNotInTheWhiteList | The user is not in volume white list. | |
| 403 | InvalidParameter.KMSKeyId.CMKNotEnabled | The CMK needs to be enabled. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service. | |
| 403 | HibernationConfigured.InstanceOperationForbidden | The 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. |
| 403 | InvalidOperation.MultiAttachDisk | Multi attach disk does not support this operation. | Disks for which the multi-attach feature is enabled do not support the operation. |
| 403 | InvalidParameter.KMSKeyId.CMKUnauthorized | The CMK has not authorized the ECS service to perform the KMS TagResource and UntagResource operations. Please verify the authorization and try again. | |
| 403 | InvalidSourceSnapshot | The source snapshot of the disk has been deleted and cannot support the current operation. | The source snapshot of the disk has been deleted and cannot support the current operation. |
| 403 | InvalidOperation.ReInitUnsupported | The specified disk does not support reInit. | The specified cloud disk does not support reinitialization. |
| 404 | InvalidDiskId.NotFound | The specified disk does not exist. | The specified disk does not exist. Check whether the disk ID is correct. |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | The specified image does not exist in this account. Check whether the image ID is correct. |
| 404 | InvalidDiskId.OperationNotSupported | The operation is not supported due to image not exist. | The specified image does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.