Snapshots are used to back up the data of disks at one or more points in time. Snapshots ensure service security and improve application deployment efficiency.

Incremental concepts

After a disk is formatted, it is divided into multiple data blocks based on logical block addresses (LBAs). When new data is written to the data blocks, these data blocks are marked to create incremental snapshots. The first snapshot created for a disk is a full snapshot. A full snapshot does not include empty data blocks of the disk. All subsequent snapshots created after the first snapshot are incremental snapshots. Incremental snapshots include only new data blocks and data blocks that have changed since the last snapshot. Therefore, snapshots can contain the same data blocks, but the data on the data blocks may be different. The following figure illustrates how incremental snapshots work. In the figure, Snapshots 1, 2, and 3 represent the first, second, and third snapshot of a disk. Incremental snapshots
Before a snapshot is created, the file system checks all the data blocks, and only data blocks whose data is modified are copied to the snapshot.
  • Snapshot 1 copies and stores all the data on the disk at the specific point in time when the snapshot is created.
  • Snapshot 2 copies and stores only Data Blocks B1 and C1, because the data on these data blocks has been modified since Snapshot 1 is created. Data Blocks A and D are referenced from Snapshot 1.
  • Snapshot 3 copies and stores only Data Block B2, because the data on this data block has been modified since Snapshot 2 is created. Data Blocks A and D are referenced from Snapshot 1, and Data Block C1 is referenced from Snapshot 2.
  • If you need to roll the disk back to the status of Snapshot 3, the Roll Back Disk feature copies Data Blocks A, B2, C1, and D to the disk.
  • If you delete Snapshot 2, Data Block B1 is deleted. Data Block C1 is retained because it is referenced by Snapshot 3. If you roll the disk back to the status of Snapshot 3, Data Block C1 can be recovered.

Snapshot chain

A snapshot chain contains all the snapshots of a specific disk. Each disk has a snapshot chain. A disk and its snapshot chain have the same ID. A snapshot chain records the relationships among data blocks and contains the following information:
  • Snapshot size: the size of storage space occupied by all snapshots in the snapshot chain.
    Note You are charged based on snapshot size. You can use the snapshot chain to check the size of a snapshot.
  • Snapshot quota: Each disk can have up to 256 manual snapshots and 1,000 automatic snapshots. For more information, see Limits.
    Note When the snapshot quota is reached, you must free up storage space to create more snapshots. For automatic snapshots, the system deletes the earliest automatic snapshot to free up storage space. For manual snapshots, you must manually delete snapshots to free up storage space. For more information, see Apply or disable an automatic snapshot policy and Delete a snapshot.
  • Node: Each node in the snapshot chain represents a snapshot of the source disk. Each snapshot chain can have up to 1,256 nodes, which is equal to the sum of quotas of manual snapshots and automatic snapshots.

Snapshot deletion

If you no longer need a snapshot, you can delete it. If the number of snapshots reaches the snapshot quota, you must delete some snapshots to free up storage space. The following figure shows the workflow and logic when you delete a snapshot from a snapshot chain. This example deletes Snapshot S1. Snapshot deletion
  1. Alibaba Cloud ECS analyzes all the data blocks in Snapshot S1, and deletes the data blocks that are not referenced by other snapshots in the chain.
  2. Alibaba Cloud ECS adds the data blocks of Snapshot S1 that are referenced by other snapshots in the chain to Snapshot S2. The remaining snapshots in the chain record the information of 10 data blocks:
    • Six data blocks from Snapshot S0
    • Two data blocks from Snapshot S1
    • Two data blocks from Snapshot S2