All Products
Search
Document Center

Elastic Compute Service:Re-initialize a data disk

Last Updated:Feb 06, 2025

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 the disk was created. This topic describes how to re-initialize a data disk.

Limits

If you delete the snapshot from which your data disk was created, you can continue to use the disk. However, you cannot re-initialize the disk.

Impacts

Before you re-initialize a data disk, make sure that you understand the items described in the following table.

Warning

After you re-initialize a data disk, all data that was written to the disk from the point in time when the disk was created to the point in time when the disk was re-initialized is cleared. We recommend that you create a snapshot for the disk to back up disk data before you re-initialize the disk. For more information, see Create a snapshot.

Item

Description

Impact on a Windows 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 must remount file systems to the disk as described in the Only mount file systems section of the "Attach a data disk" topic. All data generated after the disk was created is lost. However, the original data, partitions, and file systems of the snapshot are retained on the disk.

  • If a data disk is empty when it was created, the disk is restored to the initial state. In the initial state, the disk does not contain data, partitions, or file systems. You must initialize the data disk as described in Initialize a data disk on a Windows instance.

Impact on 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 must remount file systems to the disk as described in the Only mount file systems section of the "Attach a data disk" topic. All data generated after the disk was created is lost. However, the original data, partitions, and file systems of the snapshot are retained on the disk.

  • If a data disk is empty when it was created, the disk is restored to the initial state. In the initial state, the disk does not contain data, partitions, or file systems. You must initialize the data disk as described in Initialize a data disk on a Linux instance.

Procedure

Step 1: Make preparations

  1. The re-initialization operation clears data from a data disk. Before you re-initialize a data disk, back up the data on the disk to prevent data loss. For more information, see Create a snapshot.

    Note

    You are charged for snapshots. For information about the billing of snapshots, see Snapshots.

  2. Attach the data disk to an ECS instance. For more information, see Attach a data disk.

  3. If the disk is an Enterprise SSD (ESSD), check whether the old version of the instant access feature is disabled for the snapshots of the disk. If the old version of the instant access feature is enabled for the snapshots of an ESSD, the ESSD cannot be re-initialized.

    To determine whether the old version of the instant access feature is enabled for a snapshot, use the following method:

    • New version: In the snapshot list, Enabled is displayed in the Instant Access column.image.png

    • Old version: In the snapshot list, the expiration time of the instant access feature is displayed in the Instant Access column. Example: Oct 20, 2023, 11:07:07 Remaining Before Expiration.image.png

    For information about how to disable the old version of the instant access feature, see the Disable the instant access feature section of the "Use the instant access feature" topic.

  4. (Conditionally required) If you added commands to automatically mount data disk partitions on startup in the /etc/fstab file for a Linux instance, the instance may fail to automatically mount the data disk partitions on startup after the data disk is re-initialized to restore the initial state. In most cases, exceptions occur on startup. We recommend that you comment out the commands that are used to automatically mount data disk partitions 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. Comment out commands based on your business scenario.

    5. Press the Esc key to exit Insert mode and then enter :wq to save the file and exit.

  5. Stop the instance. For more information, see Stop an instance.

    Important

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

  6. If the data disk is an ESSD, make sure that the multi-attach feature is disabled 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

  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 Block Storage tab, find the data disk that you want to re-initialize, and then click Re-initialize Disk in the Actions column.

    重新初始化云盘

  6. In the Re-initialize Disk dialog box, read the notes and click Confirm.

    截屏2024-12-11 18

    When the disk is re-initialized, the disk re-enters the In Use state.

  7. After the re-initialization is complete, click Start to start the ECS instance.

  8. Select subsequent operations based on the ECS instance type.

    Linux instance

    • If the data disk is empty when it was created, the re-initialization operation restores the disk to the initial state. In the initial state, the data disk does not have data, partitions, or file systems. You must initialize the data disk before you can use the disk. For more information, see Initialize a data disk on a Linux instance.

    • If the data disk was created from a snapshot, you must remount file systems to the disk as described in the Only mount file systems section of the "Attach a data disk" topic after the disk is re-initialized. All data generated after the data disk was created is lost. The original data, partitions, and file systems of the snapshot are retained on the disk.

    Windows instance

    • If the data disk is empty when it was created, all data and file systems on the disk are lost. You must initialize the data disk as described in Initialize a data disk on a Windows instance.

    • 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. You must remount file systems to the disk as described in the Only mount file systems section of the "Attach a data disk" topic. All data generated after the disk was created is lost.

After you re-initialize the data disk, redeploy applications and configurations on the disk to restore your business at the earliest opportunity.