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.
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.
Step 2: Attach the system disk and data disks of the preemptible instance as data disks to a different instance
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.
You can also choose
and click Attach in the Actions column that corresponds to a disk to attach the disk to an ECS instance.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.
On the Instance page, find the instance to which you want to attach the data disk and click the instance ID.
Click the Block Storage (Disks) tab. In the upper-left corner of the Block Storage (Disks) tab, click Attach Cloud Disk.
In the Attach Cloud Disk dialog box, configure parameters to attach a disk.
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.
NoteYou can choose
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.
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.