Local snapshots provide complete copies of disk data at specific points in time and are an important method for disaster recovery. Local snapshots are stored in the same storage cluster as their source disks for fast backup and recovery of disk data. When disk data is lost, you can use a snapshot to restore the disk data to the point in time when the snapshot was created.

Prerequisites

  • The ECS instance must be in the Running or Stopped state.
  • The disk must be in the In Use or Expired state.
    Note If a disk in the Expired state reaches its scheduled release time when a snapshot is being created for the disk, the snapshot in the Creating (Creating) state will also be released together with the disk.

Background information

A local snapshot takes seconds to create, whereas a normal snapshot takes minutes. For the differences between normal snapshots and local snapshots, see Local snapshots.

When you create a snapshot, take note of the following items:
  • Local snapshots can be created only for ESSDs.
  • You must not perform operations that change the state of the ECS instance such as stopping or restarting the instance.
  • While snapshots are being created, incremental data generated by operations on disks will not be included in the snapshots.
  • 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 RAID array, we recommend that you stop applications from writing data to the dynamic extended volume or RAID array and refresh the cached data to the disk. Stop all I/O operations before you create a snapshot.
  • Created snapshots are permanently stored unless you delete them. We recommend that you delete unnecessary snapshots at regular intervals to prevent extra fees incurred by snapshot storage.

Create a local snapshot from the ECS console

The following operations demonstrate how to create a snapshot for an instance from the Instances page in the ECS console:

  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 ECS instance for which you need to create a snapshot, click the instance ID, or click Manage in the Actions column corresponding to the instance to go to the Instance Details page.
    Manage
  5. In the left-side navigation pane, click Disks.
  6. Select an enhanced SSD (ESSD), and then click Create Snapshot in the Actions column.
    Disk typeYou can create a local snapshot for a disk only when the disk meets the following conditions:
    • Disk category: ESSD
    • Encryption status: unencrypted
    • Disk type: system disk or data disk
  7. In the dialog box that appears, complete the following operations:
    Active the ECS snapshot service
    1. Enter a snapshot name in the Snapshot Name field.
    2. Select Create Local Snapshot.
    3. Set the Retention Period parameter.
    4. Optional:Binds one or more tags to the snapshot.
    5. Click Create.
  8. In the left-side navigation pane, click Snapshots to view the snapshot task.

    The normal snapshots and local snapshots that are created for the ESSD are displayed on the Snapshots page.

    View the creation result of the local snapshot

You can also choose Storage & Snapshots > Disks from the left-side navigation pane in the ECS console to create a snapshot for a disk as prompted.

Create a local snapshot by using Alibaba Cloud CLI

  1. Obtain the instance ID.
    • Method 1: If you have connected to the ECS instance, you can obtain the instance ID from the instance metadata. For more information, see 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 instance ID.
      aliyun ecs DescribeInstances --RegionId <TheRegionId> --output cols=InstanceId,InstanceName rows=Instances.Instance[]
  2. Obtain the disk ID by calling the DescribeDisks operation.
    aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk[]
  3. Call the CreateSnapshot operation to create a snapshot based on a specified disk.
    aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebp****** --Category flash
    The snapshot creation task is initiated if the following information is returned:
    {"RequestId":"16B856F6-EFFB-4397-8A8A-CB73FA******","SnapshotId":"s-bp1afnc98r8kjh******"}
  4. Query the snapshot creation progress by calling the DescribeSnapshots operation.
    aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69****** --output cols=SnapshotId,Status rows=Snapshots.Snapshot[]
    If both "SnapshotId"="s-bp1afnc98r8kjh******" and "Status":"accomplished" are displayed, the snapshot is created.

What to do next

After the snapshot is created, you can proceed with the following operations: