All Products
Search
Document Center

Elastic Compute Service:Create a disk from a snapshot

Last Updated:Dec 02, 2024

You can create a cloud disk from a snapshot. The data on the new disk is the same as the data on the source disk when the snapshot was created. Snapshot-based disk creation allows you to quickly replicate disks in the same zone or across zones for environment cloning or data backup. This topic describes how to create a cloud disk from a snapshot.

Prerequisites

A snapshot is created for a cloud disk and the snapshot ID is obtained. For more information, see Create a snapshot.

Considerations

After you create cloud disks, you cannot merge the space of the cloud disks by formatting the disks. Before you create cloud disks, we recommend that you determine the number and capacity of cloud disks that you need based on your business requirements.

Procedure

Note

The following section describes how to create a cloud disk from a snapshot on the Snapshots page in the Elastic Compute Service (ECS) console. You can perform the same operation on the cloud disk buy page or ECS instance buy page. On the cloud disk buy page, click Create from Snapshot in the Cloud Disk section. On the ECS instance buy page, click Create from Snapshot in the Data Disk section.

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Storage & Snapshots > Snapshots.

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

  4. On the Snapshots page, click the Disk Snapshots tab.

  5. Find the snapshot from which you want to create a cloud disk. In the Actions column, click Create Disk.

  6. On the cloud disk buy page, configure the parameters. The following table describes the parameters.

    Parameter or section

    Description

    Attach

    Specify whether to attach the cloud disk that you want to create to an ECS instance.

    • Not Attach: creates a cloud disk without attaching the disk to an ECS instance.

      If you select this option, you can create only pay-as-you-go cloud disks. The cloud disk and the ECS instance to which you want to attach the disk must reside in the same zone. After you create a cloud disk, you cannot change the region and zone of the disk. Exercise caution when you configure the Region and Zone parameters.

    • Attach to ECS Instance: creates a cloud disk and attaches the disk to an ECS instance.

      If you select this option, you must select a region and select an ECS instance from the ECS Instance drop-down list.

    Billing Method

    Specify the billing method of the cloud disk.

    • Pay-as-you-go: A pay-as-you-go cloud disk can be attached to a subscription or pay-as-you-go ECS instance.

    • Subscription: A subscription cloud disk can be attached only to a subscription ECS instance.

    Cloud Disk

    • The snapshot information is automatically populated.

    • Select a disk category and specify a disk capacity.

      You must specify a disk capacity that is greater than or equal to the size of the snapshot. If the disk capacity that you specify is greater than the snapshot size, you must repartition the disk to ensure that the excess disk capacity can be used.

      Important

      If the snapshot is less than 2,048 GiB in size and you want to specify a disk capacity that is greater than 2,048 GiB, make sure that the source disk of the snapshot uses the GUID Partition Table (GPT) partition style. You can run the fdisk -lu command and then determine the partition style of a disk based on the value of the Disk label type parameter in the command output. If the parameter value is gpt, the disk uses the GPT partition style. If the source disk does not use the GPT partition style, we recommend that you specify a disk capacity that is less than 2,048 GiB to prevent data loss during partitioning. For more information, see Initialize a data disk whose size exceeds 2 TiB.

    • For information about how to configure other parameters, such as the Multi-attach and Encryption parameters, see Create an empty data disk.

  7. Confirm the configurations and costs and follow the on-screen instructions to complete the purchase.

    After a cloud disk is created, you can view the disk on the Cloud Disk tab. However, the cloud disk cannot be directly used on ECS instances.

  8. The following table describes the operations that you must perform before you can use the created cloud disk.

    Scenario

    What to do next

    You set the Attach parameter to Attach to ECS Instance when you create the cloud disk.

    1. (Conditionally required) If the cloud disk created from a snapshot is attached to the Linux ECS instance to which the source disk of the snapshot is attached, the UUID of the new cloud disk conflicts with the UUID of the source disk. You must change the UUID of the new cloud disk. For more information, see Change the UUID of a disk.

    2. Mount partitions to the cloud disk or bring the disk online.

      • Linux instance

        1. Connect to the ECS instance to which the cloud disk is attached and run the following command to mount a partition to the disk:

          sudo mount <Disk partition name> <Mount point>
          • <Disk partition name>: Specify the name of the partition. Run the sudo fdisk -lu command to query the partition name. Example: /dev/vdc.

          • <Mount point>: Specify an existing directory or run the sudo mkdir -p <New directory> command to create a new directory as the mount point. Example: sudo mkdir -p /data.

          Sample mount command: sudo mount /dev/vdc /data.

        2. Write the new partition information to the /etc/fstab file. This way, the partition is automatically mounted on system startup. For more information, see the Step 4: Configure the disk partition to automatically mount on instance startup section of the "Initialize a data disk whose size does not exceed 2 TiB on a Linux instance" topic.

      • Windows instance

        1. Connect to the ECS instance to which the cloud disk is attached, click the 开始图标 icon, and then select Disk Management.

        2. Find the cloud disk that you want to manage, right-click a blank area, and select Online.image

    You set the Attach parameter to Not Attach when you create the cloud disk.

    Attach and initialize the cloud disk. For more information, see Attach a data disk.

FAQ

How do I restore the data of an ECS instance from a disk created from a snapshot when an exception occurs on the instance after an attack or intrusion?

Note

The following steps are only for reference. You can perform operations based on your actual business deployment.

  1. Create a snapshot for the system disk to back up data. For more information, see Create a snapshot.

  2. Re-initialize the system disk and clear data from the system disk. For more information, see Re-initialize a system disk.

  3. Perform the operations that are described in this topic to create a temporary pay-as-you-go cloud disk from the snapshot that you created.

  4. Attach the temporary cloud disk that you created to the ECS instance as a data disk. For more information, see Attach a data disk.

  5. Copy the business data from the temporary cloud disk to the system disk of the ECS instance and redeploy the business, including applications and configurations, based on your business scenario.

  6. Detach and release the temporary cloud disk. For more information, see Detach a data disk and Release a disk.