All Products
Search
Document Center

Elastic Compute Service:Re-initialize a system disk (reset the operating system)

Last Updated:Feb 24, 2025

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.

Warning

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

  • The system disk is restored to the state it was in when it was created. 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.

    Note

    If you replace the system disk (operating system) of an ECS instance before you re-initialize the system disk, the re-initialization operation is performed on the new system disk.

  • If an automatic snapshot policy is applied to the system disk, the policy still takes effect after the system disk is re-initialized. You do not need to re-apply the automatic snapshot policy to the system disk.

  • After you re-initialize the system disk of an ECS instance, the IP address and system disk ID of the instance remain unchanged.

  • After you re-initialize the system disk of an ECS instance, the snapshots that were created based on the system disk are retained.

Impacts on the data disks

  • After you re-initialize the system disk of an ECS instance, the data stored on the data disks attached to the instance remains unchanged and is not lost.

  • For a Linux instance, the automatic mounting information configured for the data disks attached to the instance is lost. You must remount file systems to the data disks.

  • For a Windows instance, no additional operations are required for the data disks attached to the instance.

Procedure

Step 1: Make preparations

  1. 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.

    Note

    You are charged for snapshots. For information about the billing of snapshots, see Snapshots.

  2. 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.

    To determine whether the old version of the instant access feature is enabled for a snapshot, use the following method:

    • New version: In the snapshot list, Enabled is displayed in the Instant Access column.image.png

    • Old version: In the snapshot list, the expiration time of the instant access feature is displayed in the Instant Access column. Example: Oct 20, 2023, 11:07:07 Remaining Before Expiration.image.png

    For information about how to disable the old version of the instant access feature, see the Disable the instant access feature section of the "Use the instant access feature" topic.

  3. (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.

  4. (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)
  5. Stop the ECS instance. For more information, see Stop an instance.

    Important

    If 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

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the top navigation bar, select the region and resource group to which the resource that you want to manage belongs. 地域

  4. Find the ECS instance whose system disk you want to re-initialize and click the instance ID to go to the Instance Details page.

  5. 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.

    重新初始化系统盘

  6. 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.

  7. 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.

  8. (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?

    Note

    For 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.

  9. After the system disk is re-initialized, redeploy applications and configurations on the disk to restore your business at the earliest opportunity.

FAQ