All Products
Search
Document Center

Elastic Compute Service:re-initialize a data disk

Last Updated:Mar 01, 2024

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 for a disk.

    Warning

    After 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.

    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.

  • 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 Enable multi-attach.

Step 2: Re-initialize the data disk

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. Find the ECS instance whose data disk you want to re-initialize, and click the instance ID to go to the Instance Details page.

  5. Click the Cloud Disk tab.

  6. Find the data disk that you want to re-initialize and click Re-initialize Disk in the Actions column.

    重新初始化云盘

  7. 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.

  8. (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:

      1. Connect to the Linux instance.

      2. Run the vim /etc/fstab command.

      3. Press the I key to enter Insert mode.

      4. 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
        Note

        In 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.

      5. 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.