When a data disk is attached to an Elastic Compute Service (ECS) instance, you can re-initialize the disk to restore it to the status when it was created.
- Snapshots are created for the system disk that you want to re-initialize. For more information, see Create a snapshot of a disk.
Warning When the system disk is re-initialized, all data stored on the disk is deleted. Before you re-initialize the system disk, we recommend that you create snapshots for the disk to back up data.
- 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 to which the system disk is attached is in the Stopped state. For more information, see Stop an instance.
Important If the billing method of an instance is pay-as-you-go and the network type of the instance is VPC, you must enable the standard mode for the instance when you stop the instance. If you enable the economical mode for the instance, you may not be able to start the instance after you re-initialize the disk.
- The instant access feature is not enabled for the snapshots of the disk if the disk is an enhanced SSD (ESSD). ESSDs whose snapshots have instant access enabled cannot be re-initialized. For more information, see Enable or disable the instant access feature.
- The multi-attach feature is not enabled for the disk if the disk is an enhanced SSD (ESSD).
ESSDs for which the multi-attach feature is enabled cannot be re-initialized. For more information about the multi-attach feature, see Enable multi-attach.
- (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 state of a data disk after it is re-initialized varies based on its initial state when it was created and the operating system that the instance runs:
- The data disk is restored to the initial state when it was created:
- If the data disk was initially an empty disk, the disk becomes an empty disk.
- If the data disk was created from a snapshot, the disk is restored to the state when it was created from the snapshot.
- For a Windows instance, after you re-initialize a data disk, you can use the data disk without the need to perform additional operations regardless of the initial status of the data disk.
- For a Linux instance:
- If a data disk was created from a snapshot, the disk is restored to the state when it was created from the snapshot after the data disk is re-initialized. You do not need to re-mount the partitions, but all data generated after the disk was created is lost.
- If a data disk was created as an empty disk, all data and file systems on the disk are lost after the data disk is re-initialized. You must reformat and partition the disk, and then re-mount the partitions.
- 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 Re-initialize Disk in the Actions column.
- In the Re-initialize 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 Initialize a data disk whose size does not exceed 2 TiB on 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.