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 is lost after the disk is re-initialized. You must create snapshots for the disk to back up data. For more information, see Create a snapshot for a disk.
- 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.
- The instance must be in the Stopped state before you re-initialize the disk. Your
business is interrupted when you stop your instance. Proceed with caution. For more
information, see Stop an instance.
You must select Retain Instance and Continue Charging After Instance Is Stopped when you stop a pay-as-you-go instance.Notice If you select No Charges After Instance Is Stopped, you may not be able to start the instance after you re-initialize the disk. For more information, see No Fees for Stopped Instances (VPC-Connected).
- (Applicable only to Linux instances) If you create an empty data disk and add a command
in the /etc/fstab file to mount partitions of the data disk on 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 steps:
- 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 /dev/vdb1 is a partition and /InitTest is a mount point used in this example. You can modify the command based on your actual conditions.
- Press the
Esckey to exit the edit mode, and 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 retains the data recorded in the source snapshot if it was created from a snapshot.
- For a Windows instance, after you re-initialize a data disk, the data disk is ready for use without additional operations regardless of its original status.
- For a Linux instance:
- If a 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 was created is lost.
- If a 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.
- Click the Cloud Disk tab.
- 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 only to Linux instances) 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 the applications and reconfigure the parameters on the disk to restore your business as soon as possible.