Reinitialize a cloud disk

Last Updated: May 18, 2018

When a cloud disk is attached to an ECS instance, you can reinitialize the disk to restore the system disk or the data disks to the status when they were created. After a cloud disk is reinitialized:

  • The system disk is restored to the initial status when it was created. For example, if you select a public image to create an ECS instance, after the system disk is reinitialized, the operating system is retained, but all other applications that were installed after the instance creation are deleted.

    Note: After you changed the operating system or resized the system disk, it cannot be restored to the status when you created the ECS instance, but only to the status of the new system disk when it was created.

  • The data disk is restored to the initial status when it was created: An empty disk or a disk with only the data of the source snapshot if it was created from a snapshot.

  • If an automatic snapshot policy is applied to a cloud disk, the policy is retained. You do not have to apply the policy to the disk again after reinitialization.

  • After a cloud disk is reinitialized, the IP addresses of the ECS instance and the disk ID are retained.

  • After a cloud disk is reinitialized, all the snapshots, both automatically and manually created, are retained. You can use them to roll back the disk.

Warning:

  • Your business operations may be interrupted because you have to stop your ECS instance to reinitialize a cloud disk. Therefore, proceed with caution.
  • After a cloud disk is reinitialized, its data is lost. Therefore, back up the data. For example, Create a snapshot.

This article introduces how to reinitialize a system disk and a data disk.

Reinitialize a system disk

Prerequisites

If an SSH key pair is used as the authentication method, create a key pair or import a key pair.

Procedure

  1. Log on to the ECS console.

  2. In the left-side navigation pane, click Instances.

  3. Select a region.

  4. Find an ECS instance, and click the instance ID to go to the Instance Details page.

  5. Click Stop to stop the instance.

    Note: For a Pay-As-You-Go VPC-Connected ECS instance, if the No fees for stopped instances (VPC-Connected) feature is enabled, in the Notice dialog box, click OK, and then in the Stop dialog box, select Keep Instance with Fees and click OK to stop the instance in the Keep Instance, Fees Apply mode. Otherwise, you may not start the instance successfully after you reinitialize the system disk.

    Keep instance with fees

  6. After the instance is stopped, in the left-side navigation pane, click Instance Disks.

  7. Find the system disk, and in the Actions column, click Re-initialize Disk.

  8. In the dialog box, finish the following configuration:

    1. Authentication method:
      • For a Windows instance: Specify a logon password.
      • For a Linux instance: Select Key Pair or Password as the security setting. If Key Pair is selected, bind a key pair. If Password is selected, specify a logon password.
    2. Security Enhancement: Select Free open. This is optional. After the security enhancement feature is enabled, ECS security components are loaded, which provide site backdoor detection, remote logon reminders, violent crack blocking, and other security features.
    3. Instance Startup: Select Start instance after successfully resetting the disk.
    4. Click Confirm Disk Reinitialization.
  9. For a Linux instance only: If you have attached a data disk to the instance, connect to the instance and create a mounting point for the partitions of data disks, because the mounting points are lost after the system disk is reinitialized.

    Note: For a Windows instance, both the system disk and the data disks are ready for use. No additional operations are needed.

After the system disk is reinitialized, you must deploy all applications to restore your business operations.

Reinitialize a data disk

Once reinitialized, a data disk is in different status according to its original status and the operating system of the instance: 

  • For a Windows instance: The data disk is ready for use without any additional operations regardless of its original status.

  • For a Linux instance:

    • If the data disk was an empty disk after it was created: All the data and partitions on the disk are lost. You must partition and format the disk, and mount the partitions again.

      Note: If you configured the /etc/fstab file to automatically mount the disk partitions at startup of the instance, you must comment out the lines from the file before reinitializing a data disk. Otherwise, your instance fails to start up.

    • If the data disk was created from a snapshot: The data disk is recovered to the status of the source snapshot. You do not have to mount the partitions again, but all the data generated after the disk creation is lost.

Prerequisites

The data disk to be reinitialized must be attached to an ECS instance.

Procedure

In this section, /dev/vdb1 is the example partition and /InitTest is the example mounting point. You can replace them with the actual information.

  1. For a Linux instance only: Follow these steps to comment out the mounting configuration from the /etc/fstab file:

    1. Connect to the Linux instance.
    2. Run vim /etc/fstab.
    3. Press the i key to enter the Insert mode.
    4. Locate the mounting configuration lines and type # before the lines. For example:
      1. # /dev/vdb1 /InitTest ext3 defaults 0 0
    5. Press the Esc key to exit the Insert mode, and then run :wq to save and exit.
  2. Log on to the ECS console.

  3. In the left-side navigation pane, click Instances.

  4. Select a region.

  5. Find an ECS instance, and click the instance ID to go to the Instance Details page.

  6. Click Stop to stop the instance.

    Note: For a Pay-As-You-Go VPC-Connected ECS instance, if the No fees for stopped instances (VPC-Connected) feature is enabled, in the Notice dialog box, click OK, and then in the Stop dialog box, select Keep Instance with Fees and click OK to stop the instance in the Keep Instance, Fees Apply mode. Otherwise, you may not start the instance successfully after you reinitialize the data disk.

    Keep instance with fees

  7. After the instance is stopped, in the left-side navigation pane, click Instance Disks.

  8. Find a data disk, and in the Actions column, click Re-initialize Disk.

  9. In the dialog box, read the notes and click Confirm Disk Reinitialization.

  10. In the left-side navigation pane, click Instance Details.

  11. Click Start to start the instance to complete the initialization of the data disk.

  12. For a Linux instance only: If the data disk was an empty disk after it was created, format and mount partitions again.

After the data disk is reinitialized, you may need to deploy applications to restore your business operations.

API

ReInitDisk

Thank you! We've received your feedback.