Disk Snapshot
What Is EVS Disk Snapshot?
A snapshot is a complete copy or image of the disk data at a specific point in time. Snapshots can be used as a disaster recovery (DR) approach, and you can use snapshots to fully restore data to the time when the snapshot was taken. You can create snapshots for disks on the console or via the API.
EVS disk snapshots are sometimes referred to as snapshots in this document.
You can create snapshots to rapidly save the disk data at specified time points. In addition, you can use snapshots to create new disks so that the created disks will contain the snapshot data in the beginning.
Legacy Snapshot Principles
Snapshots and backups are different in that a backup saves the data as another copy in the storage system other than on the disk, whereas a snapshot establishes a relationship between the snapshot and disk data.
- Disk v1 is created, which contains no data.
- Data d1 and d2 are written to disk v1. Data d1 and d2 are written to new spaces.
- Snapshot s1 is created for disk v1 modified in step 2. Data d1 and d2 are not saved as another copy elsewhere. Instead, a relationship between snapshot s1 and data d1 and d2 is established.
- Data d3 is written to disk v1, and data d2 is changed to d4. Data d3 and d4 are written to new spaces, and data d2 is not overwritten. The relationship between snapshot s1 and data d1 and d2 is still valid. Snapshot s1 can be used to restore data if needed.
- Snapshot s2 is created for disk v1 modified step 4, and a relationship between snapshot s2 and data d1, d3, and d4 is established.
Figure 1 Legacy snapshot principle
Standard Snapshot Principles
Standard snapshots back up data by data block. They include full snapshots and incremental snapshots. The first snapshot created for an EVS disk is a full snapshot, which backs up all data blocks on the disk at the time of the snapshot. Subsequent snapshots are incremental snapshots, which back up only changed data blocks since the last snapshot.
Metadata files of full and incremental snapshots record information about all data blocks when the snapshots were created. So, you can use any snapshot to restore the full disk data at the snapshot time.
![](https://support.huaweicloud.com/intl/en-us/productdesc-evs/en-us_image_0000001865644378.png)
Based on the data block source, a snapshot's metadata file contains information about three types of data blocks: inherited data blocks (inherited from the last snapshot), modified data blocks (have modifications compared with the last snapshot), and new data blocks (new compared with the last snapshot).
A snapshot's data file stores only the changed data blocks (modified and new data blocks) compared with the last snapshot.
Let's use the preceding figure for illustration. Assume that data is written to an EVS disk at 09:30 and 10:30. Snapshot 1 is created at 09:00, snapshot 2 is created at 10:00, and snapshot 3 is created at 11:00.
- At 09:00, snapshot 1 is created for the disk. This is the first time that a snapshot is created for this disk, so snapshot 1 is a full snapshot and it contains all the data on the disk, including data blocks A, B, and C. The metadata file of snapshot 1 records information about the disk's full data blocks: A, B, and C.
- After snapshot 1 is created, data block A is changed to A1, data block B is changed to B1, and data block D is added. Then, snapshot 2 is created at 10:00 and it is an incremental snapshot. Compared with snapshot 1, data blocks A1, B1, and D are changed data blocks. The metadata file of snapshot 2 records information about the disk's full data blocks: A1, B1, C, and D, among which data block C is inherited from snapshot 1.
- After snapshot 2 is created, data block A1 is changed to A2, data block C is changed to C1, and data block E is added. Then, snapshot 3 is created at 11:00 and it is an incremental snapshot. Compared with snapshot 2, data blocks A2, C1, and E are changed data blocks. The metadata file of snapshot 3 records information about the disk's full data blocks: A2, B1, C1, D, and E, among which data blocks B1 and D are inherited from snapshot 2.
Calculating the Standard Snapshot Storage Usage
The total snapshot storage usage of an EVS disk is calculated by snapshot chain. A snapshot chain collects the storage space used by data blocks of all the snapshots of a disk.
- Snapshot chain's storage usage calculation after snapshots are added
Take the scenario in Figure 3 as an example. Assume that the size of a snapshot's data block is fixed at 2 MiB. The snapshot chain's storage usage is calculated as follows:
- After snapshot 1 is created, the snapshot chain of the disk contains only one snapshot. Snapshot chain's storage usage = Snapshot 1's storage usage = Size of data block A + Size of data block B + Size of data block C = 6 MiB
- After snapshot 2 is created, the snapshot chain of the disk contains two snapshots: snapshot 1 and snapshot 2. Snapshot chain's storage usage = Snapshot 1's storage usage + Snapshot 2' storage usage = 6 MiB + (Size of data block A1 + Size of data block B1 + Size of data block D) = 12 MiB
- After snapshot 3 is created, the snapshot chain of the disk contains three snapshots: snapshot 1, snapshot 2, and snapshot 3. Snapshot chain's storage usage = Snapshot 1's storage usage + Snapshot 2' storage usage + Snapshot 3's storage usage = 6 MiB + 6 MiB + (Size of data block A2 + Size of data block C1 + Size of data block E) = 18 MiB
- Snapshot chain's storage usage calculation after snapshots are deleted
When a snapshot is deleted, all data block information in this snapshot's metadata file is traversed, and the following deletion principles are applied:
- If a data block is inherited by the next snapshot, it will not be deleted.
- If a data block is not inherited by the next snapshot:
- For an inherited data block, if the last snapshot that the data block is inherited from is not deleted, the data block will not be deleted. Otherwise, it will be deleted.
- For a modified data block, it will be deleted.
- For a new data block, it will be deleted.
Figure 4 Snapshot data block deletion principleThe following example describes how to calculate a snapshot chain's storage usage after snapshots are deleted.
Take the scenario in Figure 5 as an example. Assume that snapshot 2 is deleted at 14:00 and snapshot 3 is deleted at 15:00. The snapshot chain's storage usage is calculated as follows:
- Before any snapshot is deleted, the snapshot chain's storage usage is 18 MiB (Snapshot 1's storage usage + Snapshot 2's storage usage + Snapshot 3's storage usage).
- When snapshot 2 is deleted at 14:00, information about all data blocks in the metadata file of snapshot 2 is traversed.
- Data block A1: It is not inherited by snapshot 3 and is modified from data block A of snapshot 1. So, data block A1 will be deleted.
- Data block B1: It is inherited by snapshot 3, so it will not be deleted.
- Data block C: It is not inherited by snapshot 3, but is inherited from snapshot 1 and snapshot 1 is not deleted. So, data block C will not be deleted.
- Data block D: It is inherited by snapshot 3. So, it will not be deleted.
After snapshot 2 is deleted, the snapshot chain's storage usage is 16 MiB (18 MiB – Size of data block A1).
- When snapshot 3 is deleted at 15:00, information about all data blocks in the metadata file of snapshot 3 is traversed.
- Data block A2: It is not inherited by the next snapshot and is modified from data block A1 of snapshot 2. So, data block A2 will be deleted.
- Data block B1: It is not inherited by the next snapshot, but is inherited from snapshot 2 and snapshot 2 has been deleted. So, data block B1 will be deleted.
- Data block C1: It is not inherited by the next snapshot and is modified from data block C of snapshot 2. So, data block C1 will be deleted.
- Data block D: It is not inherited by the next snapshot, but is inherited from snapshot 2 and snapshot 2 has been deleted. So, data block D will be deleted.
- Data block E: It is not inherited by the next snapshot and is newly added in snapshot 3. So, data block E will be deleted.
After snapshot 3 is deleted, the snapshot chain's storage usage is 6 MiB (16 MiB – Size of data block A2 – Size of data block B1 – Size of data block C1 – Size of data block D – Size of data block E).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot