The Alibaba Cloud snapshot service is an agentless data backup service that allows you to create crash-consistent snapshots for system disks or data disks. You can use snapshots to back up data, restore Elastic Compute Service (ECS) instances that were released by mistake, and create custom images. Before you roll back disks, modify critical system files, or change the operating system of an instance, you can create snapshots for disks to improve fault tolerance.
Prerequisites
ECS Snapshot is activated. For more information, see Activate ECS Snapshot.
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 cloud disks that have never been attached to an ECS instance.
Precautions
It can take several minutes to create a snapshot. The amount of time required to create a snapshot for a disk depends on the amount of data that is written to the disk. The first snapshot of each disk is a full snapshot. Subsequent snapshots of the disk are incremental snapshots. It does not take as long to create an incremental snapshot, and the amount of time required varies based on the amount of data that has 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 incremental data is generated 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.
Snapshots that you created are stored indefinitely until you choose to delete them. We recommend that you delete the snapshots that you no longer need on a regular basis to prevent excess snapshot storage fees.
This topic describes how to create a snapshot for a single disk. If you want to simultaneously create snapshots for 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.
Procedure
Method 1: Create a snapshot for a disk in the ECS console
You can go to the Instances page in the ECS console and perform the following operations to create a snapshot for a disk:
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the upper-left corner of the top navigation bar, select a region.
Find the instance to which the disk is attached and click the instance ID.
On the Instance Details page, click the Cloud Disk tab.
Find the disk for which you want to create a snapshot and click Create Disk Snapshot in the Actions column.
In the Create Disk Snapshot dialog box, configure the parameters described in the following table and then click OK.
Parameter
Description
Snapshot Name
The name of the snapshot.
Snapshot Type
The type of the snapshot. Select Normal Snapshot or IA Snapshot.
Normal Snapshot: It can take several minutes to create a snapshot. The amount of time required to create a snapshot of a disk depends on the size of the snapshot. The first time you create a normal snapshot, the process requires a long period of time to complete. After snapshots are created, you are charged the snapshot storage fees per region based on the total size of the snapshots that are stored in the region.
IA Snapshot: It can take several seconds to create a snapshot. You can create IA snapshots only for enhanced SSDs (ESSDs). You are charged the snapshot storage fees and service fees for instance access.
For more information about the billing rules for the preceding types of snapshots, see Snapshots.
Retention Period
The number of days during which snapshots are retained. You can select Permanently or Retained For.
Instant Access
The number of days during which the instant access feature is available. When the specified duration ends, the feature is automatically disabled. This parameter is required only when you set the Snapshot Type parameter to IA Snapshot.
NoteThe duration of instant access cannot exceed the retention period of the snapshot.
Tag
The tag that you want to add to the snapshot. You can use tags to classify snapshots for easy search and batch operations.
Resource Group
The resource group to which the snapshot belongs. You can use resource groups to manage snapshots at different levels.
Click OK.
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 for a disk on the Disks page in the ECS console. To go to the Disks page, choose
in the left-side navigation pane.Method 2: Create a snapshot for a disk by using the Alibaba Cloud CLI
Obtain an instance ID.
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 the 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[]
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[]
Call the CreateSnapshot operation to create a snapshot for 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******"}
Call the DescribeSnapshots operation to query the snapshot creation progress.
aliyun ecs DescribeSnapshots --RegionId <TheRegionId> --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: