If a data disk is attached to an Elastic Compute Service (ECS) instance, you can re-initialize the disk to restore the disk to the initial state when it was created. This topic describes how to re-initialize a data disk.
Precautions
After you re-initialize a data disk, the state of the disk varies based on the initial state of the disk and the operating system that the ECS instance runs.
The data disk is restored to the initial state when the disk 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 initial state when the disk was created from the snapshot.
For a Windows instance: After you re-initialize a data disk of a Windows instance, you can use the disk without the need to perform additional operations regardless of the initial state of the disk.
For a Linux instance:
If you re-initialize a data disk that was created from a snapshot, the disk is restored to the initial state when the disk was created from the snapshot. You do not need to remount the partitions of the disk. However, all data generated after the disk was created is lost.
If you re-initialize a data disk that was initially an empty disk, all data and file systems on the disk are lost. You must reformat and partition the data disk and then remount the partitions of the disk.
Procedure
Step 1: Make preparations
Create snapshots for the data disk that you want to re-initialize. For more information, see Create a snapshot.
WarningAfter you re-initialize the data disk, all data stored on the disk is deleted. We recommend that you create snapshots for the data disk to back up data before you re-initialize the disk.
Attach the data disk to an ECS instance. For more information, see Attach a data disk.
Stop the ECS instance to which the system disk is attached. For more information, see Stop an instance.
ImportantIf 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.
Make sure that the instant access feature is disabled for the system disk if the disk is an enhanced SSD (ESSD). A disk with the instant access feature enabled cannot be re-initialized. For more information, see Enable or disable instant access.
If the data disk is an enhanced SSD (ESSD), make sure that the multi-attach feature is not enabled for the disk. You cannot re-initialize ESSDs for which the multi-attach feature is enabled. For more information, see Multi-attach for cloud disks.
Step 2: Re-initialize the data disk
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Find the ECS instance whose data disk you want to re-initialize, and click the instance ID to go to the Instance Details page.
Click the Block Storage 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.
When the disk is re-initialized, the disk re-enters the In Use state.
(Conditionally required) If the data disk was initially an empty disk and is attached to a Linux instance, perform the following operations:
After you re-initialize the data disk, format the disk before you use it. For more information, see Initialize a data disk whose size does not exceed 2 TiB on a Linux instance.
If you added commands to the /etc/fstab file to automatically mount the partitions of the data disk on system startup, the commands are not run and the instance cannot start as expected after you re-initialize the disk. We recommend that you comment out the commands in the /etc/fstab file. Perform the following steps:
Run the
vim /etc/fstab
command.Press the
I
key to enter Insert mode.Find each command that is used to mount a partition of the data disk and add a number sign (#) to comment out the command, as shown in the following example:
# /dev/vdb1 /mnt ext4 defaults 0 0
NoteIn this example, /dev/vdb1 is the data disk partition and /mnt is the mount point of the partition. Replace /dev/vdb1 and /mnt with actual values.
Press the
Esc
key to exit Insert mode and then enter :wq to save the file and exit.
After you re-initialize the data disk, redeploy applications and configurations on the disk to restore your business at the earliest opportunity.