If you want to reset an Elastic Compute Service (ECS) instance or clear the data on a system disk, re-initialize the system disk to restore the initial status of the disk. This topic describes how to re-initialize a system disk.
Limitation
If you delete or unshare the custom image from which an ECS instance was created, the instance can still be used. However, you cannot re-initialize its system disk.
Impacts
Before you re-initialize a system disk, make sure that you understand the items described in the following table.
After you re-initialize a system disk, all data that was written to the disk from the point in time when the disk was created to the point in time when the disk was re-initialized is cleared. We recommend that you create a snapshot for the disk to back up disk data before you re-initialize the disk. For more information, see Create a snapshot.
Item | Description |
Impacts on the system disk |
|
Impacts on the data disks |
|
Procedure
Step 1: Make preparations
The re-initialization operation clears data from a system disk. Before you re-initialize a system disk, back up the data on the disk to prevent data loss. For more information, see Create a snapshot.
NoteYou are charged for snapshots. For information about the billing of snapshots, see Snapshots.
When you want to re-initialize an Enterprise SSD (ESSD) series system disk, first verify the instant access feature status for the disk's snapshots. If the old version of the instant access feature is enabled for any ESSD snapshots, disk re-initialization will be blocked. Note that the new version of instant access is enabled by default for snapshots and does not affect the re-initialization process.
(Applicable only to Linux instances) If you want to use an SSH key pair for authentication when you re-initialize the system disk, you must create or import the SSH key pair. For more information, see Create an SSH key pair and Import an SSH key pair.
(Applicable only to Linux instances) After you re-initialize the system disk of a Linux instance, you must re-attach data disks to the instance. If you want the mount directory of a data disk to remain unchanged, run the following command to view the mounting information of the data disk and record the information:
sudo mount |grep "<Data disk name>"
For example, view the mounting information of the /dev/vdb data disk that has two partitions. The /dev/vdb1 partition is mounted to the /tmp directory and the /dev/vdb2 partition is mounted to the /mnt directory.
[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 system disk
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource that you want to manage belongs.
Find the ECS instance whose system disk you want to re-initialize and click the instance ID to go to the Instance Details page.
Click the Block Storage tab, find the system disk that you want to re-initialize, and then click Re-initialize Disk in the Actions column.
In the Re-initialize Disk dialog box, configure parameters.
Parameter
Description
Username
Specify a username that you want to use to log on to the instance.
Logon Credentials
For a Windows instance, select Password to reset the logon password of the instance. You can use the original password or specify a new password.
For a Linux instance, select Key Pair or Password.
Key Pair: Specify an SSH key pair to bind to the instance. Then, you can log on to the instance by using the specified SSH key pair.
Password: Reset the logon password of the instance. You can use the original password or specify a new password.
Security Hardening
By default, Enable for Free is selected. The security component is automatically loaded to your ECS instance free of charge. The security component provides security features such as webshell detection, remote logon reminders, and brute-force attack blocking.
Instance Startup Policy
By default, Start Instance After Re-initializing Disk is selected. After the system disk is re-initialized, the instance is automatically started. If the option is cleared, manually start the instance based on your business requirements.
Click Confirm to re-initialize the system disk. The disk enters the Initializing state.
After the system disk is re-initialized, the disk enters the In Use state.
(Conditionally required) If you attached data disks to a Linux instance before you re-initialize the system disk of the instance, the data stored on the data disks remains unchanged and is not lost when you re-initialize the system disk. However, the mounting information of the data disks is lost. You must re-create mount points for the data disks and remount file systems to the disks. For more information, see How do I re-attach data disks after I re-initialize the system disk of a Linux instance?
NoteFor a Windows instance, the data disks attached to the instance automatically come online after you re-initialize the system disk. No additional operations are required for the data disks.
After the system disk is re-initialized, redeploy applications and configurations on the disk to restore your business at the earliest opportunity.