Re-initialize a system disk

更新时间:
复制 MD 格式

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:

Important

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

  • The system disk is restored to its initial state, and all data written to it is erased.

    Note

    If you performed a replace system disk operation before re-initialization, the re-initialization affects the new system disk.

  • An automatic snapshot policy configured for the system disk remains in effect after re-initialization. You do not need to reconfigure it.

  • Re-initializing the system disk does not change the IP address of the ECS instance or the ID of the system disk.

  • Re-initializing the system disk does not delete any of its existing snapshots.

Effects on data disks

  • This operation does not change or erase any data on attached data disks.

  • For Linux instances: Re-initialization removes automatic mount configurations for data disks. You must remount the file systems.

  • For Windows instances: No further action is required for data disks.

Procedure

Step 1: Prerequisites

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

    Note

    You are charged for using snapshots. For more information, see Snapshot billing.

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

    You can check the version of the instant access feature by viewing its status in the snapshot list.

    • New version: The instant access status is Enabled.image.png

    • Legacy version: The instant access status shows an expiration time, for example, Expires at 00:00 on YYYY-MM-DD.image.png

    Note

    If you are using the legacy instant access feature, you can call the ModifySnapshotAttribute API operation and use the DisableInstantAccess parameter to disable the feature.

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

  4. (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)
  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 disk

Important

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.

  1. Go to ECS console - Instances.

  2. In the upper-left corner, select the region and resource group of the target instance. 地域

  3. Find the target instance and click its ID to go to the Instance Details page.

  4. On the Block Storage tab, find the target system disk, and in the Actions column, click Re-initialize Disk.

    重新初始化系统盘

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

  6. Click OK. The disk status changes to Initializing.

    The re-initialization is complete when the disk status changes back to In Use.

  7. (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.
  8. After the system disk is re-initialized, redeploy your workloads, including applications and configurations, to resume services as soon as possible.

FAQ