All Products
Search
Document Center

Elastic Compute Service:Attach the system disk or data disks of a preemptible instance to another instance to restore the data of the preemptible instance

Last Updated:Jul 05, 2024

Preemptible instances may be forcefully reclaimed due to price fluctuations or changes in supply and demand. If important data is stored on your preemptible instance, you can configure the system disk or data disks of the instance not to be released along with the instance to prevent data loss. This way, the system disk or data disks are retained as data disks when the instance is released. Then, you can attach the retained disks as data disks to a different instance to restore the data of the preemptible instance.

Working mechanism

When you create a preemptible instance, configure the system disk or data disks of the instance not to be released along with the instance. This way, when the preemptible instance is forcefully reclaimed, the system disk or data disks of the instance are retained as data disks. You can attach the retained disks as data disks to a different instance to restore the data of the preemptible instance.

The following figure shows the O&M workflow in the preceding scenario.

image

Step 1: Configure the system disk or data disks of a preemptible instance not to be released along with the instance

Clear the Release with Instance option for disks when you create a preemptible instance

When you create a preemptible instance, configure the system disk or data disks not to be released along with the instance. For information about how to create a preemptible instance, see Create an instance on the Custom Launch tab.

When you create a preemptible instance, take note of the following settings:

  • Set the Billing Method parameter to Preemptible Instance.选择抢占式实例

  • In the Storage section, clear the Release with Instance option for the system disk or data disks.基础配置时取消云盘随实例释放

Clear the Release Disk with Instance option for disks attached to an existing preemptible instance

If you created a preemptible instance, you can go to the instance details page, click the Block Storage (Disks) tab, and then clear the Release Disk with Instance option for the system disk or data disks. For more information, see the Automatically release a disk when the associated instance is released section of the "Release a disk" topic.

image

Step 2: Attach the system disk and data disks of the preemptible instance as data disks to a different instance

Important

For information about the prerequisites for attaching data disks, see Attach a data disk.

This section describes how to attach a data disk on the Instance page.

Note

You can also choose Storage & Snapshots > Block Storage (Disks) and click Attach in the Actions column that corresponds to a disk to attach the disk to an ECS instance.

  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. On the Instance page, find the instance to which you want to attach the data disk and click the instance ID.

  5. Click the Block Storage (Disks) tab. In the upper-left corner of the Block Storage (Disks) tab, click Attach Cloud Disk.

  6. In the Attach Cloud Disk dialog box, configure parameters to attach a disk.

    挂载数据盘到新实例

    1. Select the disk that you want to attach and configure the release settings for the disk. The following table describes the parameters.

      Parameter or option

      Description

      Disk

      Select the disk that you want to attach.

      Note

      You can choose Storage & Snapshots > Block Storage (Disks) to view information about the retained disks of the reclaimed preemptible instance in the disk list.

      Release Cloud Disk with Instance

      If you select this option, the disk is automatically released when the instance is released. If you do not select this option, the disk is retained when the instance is released.

      Delete Automatic Snapshots While Releasing Disk

      If you select this option, the automatic snapshots of the disk are released when the disk is released. We recommend that you do not select this option. We recommend that you retain the automatic snapshots of the disk.

    2. Click Next.

      If the data disk is attached to the new instance, a message indicating that the disk is attached to the instance appears, and the disk enters the In Use state.