Scenarios
You can use Snapshot Group to create snapshots for multiple cloud disks in an instance at the same time.
Prerequisites
- You have successfully created the CVM.
- The quantities and total capacity of your snapshots in the current region have not reached the maximum value. For details, see Snapshot Usage Limitations.
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 (for example, files under the Linux system /run directory). 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:
Execute theFLUSH TABLES WITH READ LOCKcommand to close all opened tables and use the global read lock to lock all tables in all databases. As shown below:

Create a snapshot of the cloud disk.
ExecuteUNLOCK TABLESto unlock. 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 thesynccommand to force the data in the memory buffer of the file system to be written into the cloud disk immediately and avoid writing new data before creating a 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 Snapshot Groups Using the Console
- Log in to the CVM console.
- On the Instances page, click More > Create Snapshot Group on the right side of the row containing the target instance.
- In the pop-up Create snapshot group dialog box, input the snapshot name and click Confirm.
Creating Snapshot Groups Using the API
You can use the CreateSnapshotGroup API to create snapshot groups.


