All Products
Search
Document Center

Elastic Compute Service:Create a disk from a snapshot

Last Updated:Nov 20, 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

This section describes how to create cloud disks from a snapshot on the Snapshots page in the Elastic Compute Service (ECS) console. You can perform the same operation on the disk or instance buy page: On the disk buy page, select Create from Snapshot in the Storage section. On the ECS instance buy page, select 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 cloud disks. In the Actions column, click Create Disk.

  6. Configure the parameters on the disk buy page. The following table describes the parameters.

    Parameter or section

    Description

    Attach

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

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

      If you select this option, you can create only pay-as-you-go disks. The cloud disks and the ECS instance to which you want to attach the disks 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 parameter.

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

      If you select this option, you must select a region and an ECS instance in the ECS Instance section.

    Billing Method

    Specify the billing method of the cloud disks.

    • Pay-as-you-go: Pay-as-you-go disks can be attached to subscription or pay-as-you-go instances.

    • Subscription: Subscription disks can be attached only to subscription instances.

    Storage

    • The snapshot information is automatically populated.

    • Select a disk category and specify a disk capacity.

      You must set a disk capacity 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.

    • Performance Level: You can specify performance levels only for Enterprise SSDs (ESSDs). Single-disk performance varies based on the ESSD capacity and performance level. You can specify performance levels for ESSDs of different capacities based on your business requirements. For more information, see ESSDs.

    • Multi-Attach: When you create a cloud disk of an ESSD series category, you can enable the multi-attach feature for the disk. This way, the cloud disk can be attached to multiple instances in the same zone. For more information, see Multi-attach for cloud disks.

    • Disk Encryption: If you select this option, the data stored on the cloud disk is automatically encrypted. For more information, see Encrypt disks.

    Quantity

    Specify the number of cloud disks that you want to create.

    Important
    • You can attach up to 64 data disks to an ECS instance. The number of cloud disks that can be attached to an instance varies based on the instance type. You can call the DescribeInstanceTypes operation to query the number of cloud disks that can be attached to an instance of an instance type.

    • You have a zone-specific capacity quota for cloud disks. The total capacity of the cloud disks that you want to create is calculated by using the following formula and counts against the capacity quota: Capacity per cloud disk × Number of cloud disks that you want to create. After you select a disk category, the purchased capacity and the remaining capacity quota of the disk category are displayed on the cloud disk buy page. You can go to the Quota Center to view and adjust your disk capacity quotas.

    Release

    Specify whether to delete the automatic snapshots of the cloud disks when the disks are released or whether to release the cloud disks when the ECS instance to which they are attached is released. This parameter is available only if you select Attach to ECS Instance and set the Billing Method parameter to Pay-as-you-go.

    Terms of Service

    Read and select ECS Terms of Service and Product Terms of Service.

    Others (Optional)

    To identify and manage the cloud disks, configure the Name, Description, Tag, and Resource Group parameters.

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

    After the cloud disks are created, you can view the disks on the Block Storage page. However, the cloud disks cannot be directly used on ECS instances.

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

    Scenario

    What to do next

    You select Attach to ECS Instance when you create cloud disks

    1. (Conditionally required) If you create a disk from a snapshot and attach the created disk to the ECS Linux instance to which the source disk of the snapshot is attached, the UUIDs of the new disk and source disk conflict. You must change the UUID of the new 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.

          • The example of mount: 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 in 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 select Not Attach when you create cloud disks

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