After a snapshot is taken for the qcow2 disk, it records the state of the qcow2 disk at the time of the snapshot — i.e., the data locations described by the qcow2 file at that time. This snapshot is stored in a specific location within the qcow2 file.
After the snapshot is created, when data is written to the same location, the steps are as follows:
①When creating a snapshot for the virtual machine (VM), the system generates a new dynamically expanding disk file (i.e., snapshot space).
②After the snapshot is created, modifying the original data will trigger the following actions: the system first copies the original disk data to the snapshot space, then writes the data in the cache to the original disk file, and finally records the corresponding relationship between the logical addresses of the source virtual disk and the snapshot space in the mapping table.