Scenarios
You can create a snapshot from a cloud disk to save the cloud disk data at a specified point in time. Snapshots are created incrementally, meaning only the data that has changed since the last snapshot is created. In this way, data changes are minimal, so that snapshots can be created quickly. Although snapshots are created incrementally, deleting a snapshot does not affect your use of any snapshot data. Any undeleted snapshot can restore the cloud disk to that snapshot's state.
You can create a snapshot from any state of a cloud disk, but a snapshot can only save data that has been written at the current time. If an application or process is writing data, such data may not be saved to the snapshot created at that time. Depending on your actual business situation, you can choose to temporarily stop all writes and create a snapshot promptly, or first detach the cloud disk from the CVM, create a snapshot, and then reattach it to obtain a complete data snapshot.
Prerequisites
- The cloud disk has been successfully created.
Notes
The snapshot only retains the data that has been written to the hard disk at that time and does not retain the data that has not been written to the hard disk in the memory at that time. It is strongly recommended that you shut down your computer before creating a snapshot or ensure that memory data has been written to the hard disk, pause reading and writing from the hard disk, and operate in the following two ways:
- Database Level
For database business, it is recommended that all tables in the database be locked to read-only status first to prevent new data from being written into when creating a snapshot so that new data cannot be captured by the snapshot. This document takes mysql as an example to perform the following operations:
ExecuteFLUSH TABLES WITH READ LOCKcommand to close all opened tables, and lock all tables in all databases using global read-lock. As shown below:

Create a snapshot of the cloud disk.
ExecuteUNLOCK TABLEScommand for unlocking. As shown below:

- System Level
From the perspective of the system, data is usually stored in the memory buffer during processing and then written into the cloud disk at an appropriate time to improve the operation efficiency of the system. Therefore, when a snapshot is created, the data that has not been written into the cloud disk in the buffer cannot be written to and recovered from the snapshot, which affects data consistency.
Execute the commandsyncto force the data in the file system memory buffer to be written to the cloud disk immediately, and avoid writing new data before creating the snapshot.
After the command is executed, no error message will be returned; that is, the data in the cache has been written to the cloud disk. As shown below:

Operation Steps
Creating Snapshots Using the Console
- Log in to the CBS console.
- Click Create Snapshot in the target cloud disk row.
- In the create snapshot dialog box, enter the snapshot name and click OK.
Creating Snapshots Using the API
You can create a snapshot using the CreateSnapshot interface.


