All Products
Search
Document Center

Elastic Compute Service:Create a disk from a snapshot

Last Updated:Mar 25, 2024

Use a snapshot to create a disk. The data on the new disk is the same as the data that existed on the source disk when the snapshot was created. Snapshot-based disk creation allows you to quickly replicate disks for environment cloning or data backup. You can use a snapshot to create system disks or data disks. This topic describes how to create a disk from a snapshot.

Prerequisites

A snapshot of a system disk or data disk is created and the ID of the snapshot is obtained. For more information, see Create a snapshot for a disk.

Limits

When you create a disk from a snapshot, take note of the following limits:

  • Disks are independent of each other and cannot be merged by formatting. Before you create disks, we recommend that you determine the number and capacity of disks that you need based on your business requirements.

  • We recommend that you do not use Logical Volume Manager (LVM) to create logical volumes across multiple disks. A snapshot can back up the data of only a single disk. If you create a logical volume across multiple disks by using LVM, data discrepancies may occur when you roll back the disks.

  • If you create a disk from a snapshot and attach the new disk to the Elastic Compute Service (ECS) instance to which the source disk of the snapshot is attached, the UUID of the new disk conflicts with the UUID of the source disk. In this case, you must change the UUID of the new disk. For more information, see Change the UUID of a disk.

  • You can use a snapshot that resides in one zone to create disks in another zone. For example, you can use a snapshot that resides in Hangzhou Zone A to create disks in Hangzhou Zone B.

Procedure

You can create disks from a snapshot on the Disks page and the Snapshots page. The following section describes how to create disks from a snapshot on the Disks page.

  1. Log on to the ECS console.

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

  3. In the upper-left corner of the Disks page, click Create Disk.

  4. In the Storage section of the disk buy page, click Create from Snapshot and then select a snapshot.

    image.png

  5. Configure the parameters. The following table describes the parameters.

    Parameter or section

    Description

    Attach

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

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

      If you select this option, you can create only pay-as-you-go disks. The disks and the ECS instance to which you want to attach the disks must belong to the same zone. After you create a 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 disks and attaches the disks to an ECS instance.

      If you select this option, you must configure the ECS Instance parameter by selecting a region and an ECS instance.

    Note

    You can use a snapshot that belongs to one zone to create disks in another zone. For example, you can use a snapshot that belongs to Hangzhou Zone A to create disks in Hangzhou Zone B.

    Billing Method

    Specify the billing method of the 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

    Select a disk category and specify a disk capacity.

    You must specify a disk capacity that is at least the same size as 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 that is larger than 2 TiB in size.

    Other parameters:

    • Performance Level: You can specify performance levels only for enhanced SSDs (ESSDs). You can select a performance level based on the capacity of an ESSD. The performance of an ESSD varies based on the capacity of the ESSD and the performance level. For more information, see ESSDs.

    • Multi-attach: You can select this option to enable the multi-attach feature for ESSDs. This way, an ESSD can be attached to multiple instances in the same zone. For more information, see Enable multi-attach.

    • Disk Encryption: Disk encryption is suitable for scenarios that require data security and regulatory compliance. If you select this option, data that is stored on the created disks is automatically encrypted.

    Quantity

    Specify the number of disks that you want to create.

    Note
    • When you create disks, take note of the number of data disks on the instance to which you want to attach the disks. The number of data disks that can be attached to an ECS instance is limited. For more information, see the Block storage limits section of the "Limits" topic.

    • Disks have capacity quotas. The total capacity of the disks that you purchase cannot exceed the remaining capacity quota. You can calculate the total disk capacity by using the following formula: Total capacity = Capacity of a single disk × Number of disks. After you select a disk category, the purchased capacity and the remaining capacity quota are displayed on the disk buy page.

    Release

    Specify whether to release the disks or the automatic snapshots of the disks together with the instance to which the disks are attached. 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)

    Configure the Name, Description, Tag, and Resource Group parameters to help you identify and manage the disks.

  6. Confirm the configurations and fees, click Preview, and then proceed as prompted to create the disks.

    After you create the disks, you can view the disks on the Disks page. However, the disks cannot be directly used on the ECS instance. You must perform the required operations to use the disks. For more information, see the "What to do next" section of this topic.

What to do next

In most cases, a disk that is created from a snapshot contains data and does not need to be initialized. To use the new disk that is created from a snapshot on an instance, you need to only perform the following operations based on the operating system of the instance:

  • Linux instance:

    1. If the disk is attached to a Linux instance, log on to the instance and run the following command to perform the mount operation:

      mount <Disk partition name> <Mount point>
      • <Disk partition name>: You can log on to the instance to which the source disk of the snapshot is attached and run the df -h command to query the disk partition name.

      • <Partition mount point>: You can specify an existing directory as the mount point or run the mkdir -p <Mount point of the partition> command to create a directory as the mount point. The mount point must start with a forward slash (/) and contain letters or digits. Example: /mnt.

    2. Writes the new partition information to the /etc/fstab file. This way, the partition is automatically mounted on system startup.

      For more information, see Step 4: Configure the disk partition to automatically mount on instance startup.

  • If the disk is attached to a Windows instance, log on to the instance and connect the disk online in the Disk Management window. For more information, see Step 1 to Step 4 in Initialize a data disk up to 2 TiB in size on a Windows instance.