All Products
Search
Document Center

Elastic Compute Service:ReInitDisk

Last Updated:Oct 09, 2026

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ReInitDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

  • ecs:PasswordCustomized
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 Password parameter, use HTTPS to send requests to prevent password leaks.

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:

  • true: Automatically starts the instance.

  • false: Does not automatically start the instance.

Default value: false.

true

SecurityEnhancementStrategy

string

No

Specifies whether to use Security Center for free after the specified system disk is reinitialized. Valid values:

  • Active: Uses Security Center. This value is supported only for public images.

  • Deactive: Does not use Security Center. This value is supported for all images.

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.