If you need to reset an ECS instance or clear data from its system disk, you can re-initialize the system disk to restore it to its initial state. This topic describes how to re-initialize a system disk.
Limitations
If you create an instance from a custom image and later delete that image, you can still use the instance. However, you cannot re-initialize its system disk.
Impact of re-initialization
Be aware of the following impacts before you proceed:
Re-initializing a system disk erases all data written to it since it was created. We strongly recommend that you create a snapshot to back up the system disk data before you proceed. For more information, see Create a snapshot manually.
|
Item |
Description |
|
Effects on the system disk |
|
|
Effects on data disks |
|
Procedure
Step 1: Prerequisites
-
Re-initializing a system disk erases all data written to it. To prevent data loss, create a backup of the target disk before you proceed. For more information, see Create a snapshot manually.
NoteYou are charged for using snapshots. For more information, see Snapshot billing.
-
Ensure that the legacy instant access feature is disabled for snapshots of ESSD-series disks. You cannot re-initialize a disk if its snapshots have the legacy instant access feature enabled. The new version of the instant access feature is enabled by default and does not affect the re-initialization operation.
-
(For Linux instances only) If you need to use an SSH key pair for authentication, create or import an SSH key pair first. For more information, see Create an SSH key pair and Import an SSH key pair.
-
(For Linux instances only) After you re-initialize the system disk, you must remount any data disks. If you want to use the same mount points, run the following command to record the current mount information of the data disks.
sudo mount |grep "<data-disk-name>"For example, to view the mount information for the data disk /dev/vdb, run the command. The output shows that the data disk /dev/vdb has two partitions: /dev/vdb1 is mounted to /tmp, and /dev/vdb2 is mounted to /mnt.
[ecs-user@ecs ~]$ sudo mount |grep "/dev/vdb" /dev/vdb1 on /tmp type ext4 (rw,relatime) /dev/vdb2 on /mnt type ext4 (rw,relatime) -
Stop the ECS instance. For more information, see Stop an instance.
ImportantIf an ECS instance uses the pay-as-you-go billing method and resides in a VPC, you must enable the standard mode when you stop the instance. If you enable the economical mode, you may be unable to start the instance after you re-initialize the disks attached to the instance.
Step 2: Re-initialize the disk
Re-initializing a system disk erases all data written to it since it was created. We strongly recommend that you create a snapshot to back up the system disk data before you proceed. For more information, see Create a snapshot manually.
Go to ECS console - Instances.
-
In the upper-left corner, select the region and resource group of the target instance.

-
Find the target instance and click its ID to go to the Instance Details page.
-
On the Block Storage tab, find the target system disk, and in the Actions column, click Re-initialize Disk.

-
In the Re-initialize Disk dialog box, configure the parameters.

Parameter
Description
Logon Username
Select a username to log on to the operating system.
Logon Credential
For a Windows instance, reset the logon password. You can reuse the current password or specify a new one.
For a Linux instance, select Key Pair or Password.
-
Key Pair: Bind an SSH key pair to the instance for logon.
-
Password: Reset the logon password. You can reuse the current password or specify a new one.
Security Hardening
The Activate option is selected by default. This option automatically installs the free Security Agent on your instance to provide security features such as backdoor detection, unusual logon alerts, and brute-force attack prevention.
Whether to restart the instance
By default, Whether to restart the instance after initialization is complete is selected. After the instance is re-initialized, it automatically starts. If this option is not selected, you must manually start the instance as needed.
-
-
Click OK. The disk status changes to Initializing.
The re-initialization is complete when the disk status changes back to In Use.
-
(Conditionally required) For Linux instances with attached data disks, you must remount the data disks after re-initialization. The operation does not change or erase data on the data disks, but the re-initialization removes their mount information from the operating system. You must create new mount points and remount the file systems. For more information, see How do I remount a data disk after I re-initialize the system disk of a Linux ECS instance?.
For Windows instances, data disks automatically come online after the system disk is re-initialized. No further action is required.
-
After the system disk is re-initialized, redeploy your workloads, including applications and configurations, to resume services as soon as possible.
FAQ
-
Why do I receive the error message "The operation is not supported to the specified disk that have snapshots with InstantAccess enabled." when I try to re-initialize a disk?
This may be because the instant access feature is enabled for the snapshots of the disk. You cannot re-initialize a disk if this feature is enabled. For more information about how to disable the instant access feature, see Instant access capability.

