All Products
Search
Document Center

Elastic Compute Service:how snapshots work

Last Updated:Jan 26, 2025

Snapshots are point-in-time backups of disks. You can use a snapshot of a disk to restore disk data to the point in time when the snapshot was created. This topic describes how to create snapshots, delete snapshots, how the snapshot size is calculated, and the relationship between the snapshot size and disk size.

How snapshots are created

Snapshots can be created manually or automatically for disks as needed. For detailed instructions, see Create snapshots or Create automatic snapshot policies.

Principles

Snapshots operate on the principle of data block granularity, distinguishing between full and incremental snapshots. The initial snapshot of a disk is a full snapshot, capturing all data present at the time of creation. Subsequent snapshots are incremental, recording only the data blocks that have changed since the last snapshot. This approach conserves storage space and reduces costs. Both full and incremental snapshots maintain information about all data blocks, enabling complete disk restoration from any snapshot.

Once created, snapshots are automatically stored in Alibaba Cloud Object Storage Service (OSS) for secure, long-term storage and flexible data restoration. For additional details, see Storage locations.

Example description

Consider a disk of an ECS instance with business modifications and new data written at 10:00 and 11:00. The following illustrates how disk snapshots function:

  1. At 9:00, the disk contains data blocks A, B, and C. Snapshot 1 is created, capturing all these data blocks as a full snapshot.

  2. After further data is written, changes to data blocks A and B and the addition of data block D occur. Snapshot 2, taken at 10:00, is an incremental snapshot that includes these changes and additions, along with the unchanged data block C from Snapshot 1.

  3. Continued data writing results in changes to data block C and the addition of data block E. Snapshot 3, created at 11:00, is another incremental snapshot that captures these new changes and additions, along with the data blocks inherited from Snapshot 2.

  4. This process repeats as needed.

image

How snapshots are deleted

To free up space or when the maximum number of snapshots is reached, you can delete unnecessary snapshots. For instructions, see Delete snapshots.

Note

To view the limits on manual snapshots, automatic snapshots, each disk can support, see Limits.

Principles

Since both full and incremental snapshots contain information about all data blocks, any undeleted snapshot can be used to restore the entire disk to its state at the time of the snapshot's creation. Deleting a full snapshot transfers its properties to the first contiguous incremental snapshot.

Example description

Suppose Snapshots 1, 2, and 3 are created for a disk of an ECS instance. Below is a description of the data blocks each snapshot contains:

  • Snapshot 1: A full snapshot with data blocks A, B, and C.

  • Snapshot 2: An incremental snapshot with changed data blocks A1, B1, and new data block D, along with the unchanged data block C from Snapshot 1.

  • Snapshot 3: An incremental snapshot with changed data block C1 and new data block E, along with unchanged data blocks A1, B1, and D from Snapshot 2.

The following describes the deletion process for these snapshots:

  1. Deleting Snapshot 1 (full snapshot) turns Snapshot 2 into a full snapshot containing data blocks A1, B1, C, and D. Snapshot 3 remains an incremental snapshot.

  2. Deleting Snapshot 2 (now a full snapshot) makes Snapshot 3 a full snapshot with data blocks A1, B1, C1, D, and E.

  3. Deleting Snapshot 3 (full snapshot) removes all its data blocks.

image

How is the snapshot size calculated

Principles

Each disk's total snapshot size is determined by its snapshot chain (the interconnected snapshots of the disk) and the storage space the snapshots' data blocks occupy. Storage fees for standard snapshots are calculated based on the size of the snapshot chain. For more information, see how to view a single disk's snapshot size based on the snapshot chain and snapshot billing details.

Note

Please note there may be a delay of several minutes in calculating the snapshot chain size. Actual fees are based on the bill.

The following terms are related to snapshot size:

  • Full snapshot size: The storage space used by all data blocks in a single snapshot.

  • Incremental snapshot size: The storage space used by data blocks that have changed since the previous snapshot in the same chain.

  • Total snapshot size: The sum of the full snapshot size and all subsequent incremental snapshot sizes.

Snapshot size calculation example

Consider a disk with three standard snapshots, which together create the disk's standard snapshot chain.

  • Snapshot 1: A full snapshot that captures all data blocks A, B, and C, totaling 30 GB.

  • Snapshot 2: An incremental snapshot that records only the changes in data blocks A1, B1, and D since Snapshot 1, with a size of 30 GB.

  • Snapshot 3: Another incremental snapshot that captures changes in data blocks C1 and E since Snapshot 2, amounting to 20 GB.

The total size of the standard snapshots is the sum of the full Snapshot 1 and the incremental Snapshots 2 and 3, which equals 80 GB.

image

Relationship between snapshot size and disk size

The size of an individual snapshot does not exceed the size of its corresponding disk. However, the cumulative size of all snapshots may surpass the disk size as the number of snapshots grows.

For example, if you create a 40 GB disk and initially write 20 GB of data to it, the first snapshot will be 20 GB. If you then add another 10 GB of data, the disk size will still be 40 GB, but the total snapshot size will increase to 30 GB. This pattern continues with further data additions.

You can determine the size of a disk and its snapshots by examining the snapshot chain. For detailed instructions, see View the Snapshot Size of a Single Disk Based on the Snapshot Chain. The diagram below illustrates this concept, where ① represents the disk size and ② indicates the total size of all snapshots on the disk. image

Difference between snapshot size and system size

  • Snapshots calculate their size using fixed-size data blocks, which represent the smallest unit for snapshot data backup.

  • Deleting a file from a disk reduces the used capacity shown in the operating system, but the file's data remains physically on the disk, merely marked as Deleted. Thus, deleting files is a write operation that doesn't decrease the actual disk space used by data. If a snapshot is taken before file deletion, it will still include the data blocks of the now-deleted file. For physical file deletion details, refer to the documentation on the TRIM mechanism for file systems.

  • Snapshot sizes can increase without new data being written to the system disk, as the operating system generates and writes system files to the disk, which are then included in snapshots.

  • A snapshot's size may exceed the actual data written to the disk due to file system metadata occupying additional space. For instance, creating a 1 MB text file on a disk results in a snapshot size that is more than 1 MB, as it includes both the file data and the associated metadata.