Reinitializes a disk to its initial state when it was created.
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 that is attached to an instance before the instance starts for the first time.
You cannot reinitialize a disk that has local snapshots.
For a system disk, the disk is reinitialized to the initial state of the image. If the source image used to create the disk has been deleted, the disk cannot be reinitialized.
For a data disk that was created from scratch, the disk is reinitialized to an empty disk. For a data disk that was created from a snapshot, the disk is reinitialized to the snapshot state. If the source snapshot has been 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. |
d-bp67acfmxazb4ph**** |
| Password |
string |
No |
Specifies whether to reset the username and password of the ECS instance when the system disk is reinitialized. 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 following special characters are supported:
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 the system disk is reinitialized, you can attach an SSH key pair to the ECS instance as the logon credential. After you use an SSH key pair, the username and 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 the free Security Center service after the 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. | |
| 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 some unknown error, exception or failure. | An internal error has occurred. Try again later. |
| 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 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. |
| 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 creating is windows, cannot use ssh key pair to login. | |
| 403 | InvalidDisk.DiskFromClonedNotSupport | The specified disk %s is cloned from source disk %s, so not support reinit | |
| 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 have no right to access your KMS. | ECS is not authorized to access your KMS resources. |
| 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 needs to be added ECS tag. | |
| 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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.