When a data disk is attached to an ECS instance, you can re-initialize the disk to restore it to the status when it was created.
- Data will be lost after the system disk is reinitialized. You must create a snapshot from the disk to back up data. For more information, see Create a normal snapshot.
- The data disk is attached to an instance. For more information about how to attach a data disk to an instance, see Attach a data disk.
- You must stop the ECS instance before reinitializing a system disk. In this case,
your business will be interrupted. Proceed with caution. For more information, see
Stop an instance.
For a pay-as-you-go ECS instance, you must select Retain Instance and Continue Charging After Instance Is Stopped when you stop the instance.Notice If you select No Charges After Instance Is Stopped, you may not be able to start the instance after you reinitialize the system disk. For more information, see No Fees for Stopped Instances (VPC-Connected).
- (Applicable to Linux instances only) If you create an empty data disk and add a command
in the /etc/fstab file to mount partitions of the data disk at the system startup, the command is not
executed and the instance cannot start up as expected after you re-initialize the
data disk. We recommend that you comment out the command in the /etc/fstab file. Perform the following operations:
- Connect to the instance. For more information, see Overview.
- Run the
- Press the
Ikey to enter the edit mode.
- Find the command used to mount data disk partitions and comment it out by using #, as shown in the following line:
# /dev/vdb1 /InitTest ext3 defaults 0 0Note The /dev/vdb1 partition and the /InitTest mount point are used in this example. You can modify the command based on your actual conditions.
- Press the
Esckey to exit the edit mode. Then, enter :wq to save the file and exit.
The status of a data disk after it is re-initialized varies based on its original status when it was created and the operating system that the instance runs:
- The data disk is restored to the initial status when it was created:
- The data disk becomes an empty disk if it was originally an empty disk.
- The data disk stores the data recorded in the source snapshot if it was created from a snapshot.
- For a Windows instance, after you re-initialize its data disk, the data disk is ready for use without additional operations regardless of its original status.
- For a Linux instance:
- If the data disk was created from a snapshot, the data disk stores only the data recorded in the source snapshot after it is re-initialized. You do not need to mount the partitions again, but all the data generated after the disk is created is lost.
- If the data disk was created as an empty disk, all the data and file systems on the disk are lost. You must reformat and partition the disk, and then mount the partitions again.
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- Find the ECS instance for which you want to re-initialize a data disk, and click the instance ID to go to the Instance Details page.
- In the left-side navigation pane, click Disks.
- Find the data disk that you want to re-initialize, and click Reinitialize Disk in the Actions column.
- In the Reinitialize Disk dialog box, read the notes and click Confirm.
What to do next
- (Applicable to Linux instances only) If the data disk was created as an empty disk, you must format the data disk after you re-initialize it. For more information, see Format a data disk for a Linux instance.
- After the data disk is re-initialized, you must redeploy and configure applications to restore your business as soon as possible.