The Alibaba Cloud snapshot service is an agentless backup service that allows you to create crash-consistent snapshots of system or data disks. You can use snapshots to back up data, restore Elastic Compute Service (ECS) instances that were accidentally released, and create custom images. You can create snapshots of disks to improve fault tolerance before you roll back a disk, modify key system files, or change the operating system of an instance.

Prerequisites

The disk for which you want to create a snapshot is in the In Use or Unattached state. Take note of the following items:
  • If the disk is in the In Use state, make sure that the ECS instance to which the disk is attached is in the Running or Stopped state.
  • If the disk is in the Unattached state, make sure that the disk was at some point attached to an ECS instance. Snapshots cannot be created for disks that have never been attached to ECS instances.

Background information

It can take several minutes to create a snapshot. The amount of time required to create a snapshot of a disk depends on the amount of data written to the disk. The first snapshot of each disk is a full snapshot. Subsequent snapshots of the disk are incremental snapshots. It takes longer to create a full snapshot than an incremental snapshot. The amount of time required to create an incremental snapshot varies based on the amount of data changed since the previous snapshot. The more data that has changed, the longer it takes.

When you create a snapshot, take note of the following items:
  • Do not perform operations that change the state of the instance, such as stopping or restarting the instance.
  • You are charged for snapshots. For more information, see Snapshots.
  • We recommend that you create snapshots during off-peak hours because snapshot creation degrades the I/O performance of disks by up to 10% and slows down data reads and writes.
  • If operations are performed on the disk and generate incremental data while a snapshot is being created, the incremental data is not included in the snapshot.
  • If you create an extended volume from a single multi-partition disk, the snapshot that you created can be used to roll back the disk.
  • When a disk is used to create a dynamic extended volume or a RAID array, we recommend that you create a snapshot-consistent group and enable the application-consistent snapshot feature. For more information, see Create a snapshot-consistent group and Create application-consistent snapshots in the ECS console.
  • Your created snapshots are stored indefinitely until you choose to delete them. We recommend that you delete unneeded snapshots on a regular basis to prevent excess fees caused by snapshot storage.

This topic describes how to create a snapshot of a single disk. If you want to simultaneously create snapshots of multiple disks on one or more instances, use the snapshot-consistent group feature. For more information, see Create a snapshot-consistent group. When a business system spans multiple disks, you can create a snapshot-consistent group to ensure a consistent write order and crash consistency of business system data.

Create a snapshot in the ECS console

You can go to the Instances page in the ECS console and perform the following operations to create a snapshot of a disk:

  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 a region.
  4. Find the instance to which the disk is attached and click the instance ID.
  5. On the Instance Details page, click the Cloud Disk tab.
  6. Find the disk for which you want to create a snapshot and click Create Snapshot in the Actions column.
  7. In the Create Snapshot dialog box, configure the parameters described in the following table and then click OK.
    Parameter Description
    Snapshot Name The name of the snapshot.

    The name cannot start with auto because a snapshot whose name starts with auto is recognized as an automatic snapshot.

    Instant Access The instance access feature can accelerate the process of snapshot creation. You can use the instant access feature to create snapshots within seconds.

    If you are using an enhanced SSD (ESSD), you can turn on Instant Access. For more information, see Enable or disable the instant access feature.

    Duration of Instant Access The number of days during which the instant access feature is available. The instant access feature is automatically disabled when the specified duration ends.
    Tag The tag key and value of the snapshot.
    After the snapshot is created, you can click the Snapshot tab on the Instance Details page to view the created snapshot.

You can also create a snapshot of a disk on the Disks page in the ECS console. To go to the Disks page, choose Storage & Snapshots > Disks in the left-side navigation pane.

Create a snapshot by using Alibaba Cloud CLI

  1. Obtain the ID of the instance for which you want to create a disk snapshot.
    • Method 1: If you are connected to the instance, you can obtain the instance ID from the instance metadata. For more information, see Overview of ECS instance metadata.
      For example, to query the ID of a Linux instance, run the following command:
      curl http://100.100.100.200/2016-01-01/meta-data/instance-id
    • Method 2: Use Alibaba Cloud CLI to call the DescribeInstances operation to obtain the ID of the instance.
      aliyun ecs DescribeInstances --RegionId <TheRegionId> --output cols=InstanceId,InstanceName rows=Instances.Instance[]
  2. Call the DescribeDisks operation to obtain the ID of a disk based on the obtained instance ID.
    aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk[]
  3. Call the CreateSnapshot operation to create a snapshot of the disk.
    aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebp******
    If the task to create a snapshot is initiated, the following response is returned:
    {"RequestId":"16B856F6-EFFB-4397-8A8A-CB73FA******","SnapshotId":"s-bp1afnc98r8kjh******"}
  4. Call the DescribeSnapshots operation to query the snapshot creation progress.
    aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69****** --output cols=SnapshotId,Status rows=Snapshots.Snapshot[]
    If the snapshot is created, both "SnapshotId"="s-bp1afnc98r8kjh******" and "Status":"accomplished" are displayed.

What to do next

After a snapshot is created, you can perform the following operations on the snapshot: