With the automated scripts for creating and deleting VMS, life is much simpler.
However, in a test scenario, we often need to constantly restore the VM to a starting point, and then re-start the test. It is still slow to delete/create a VM every time.
In this case, you can use the Save/restore method.
The Save/restore method only backs up and restores the memory status of the current system, and does not back up disk files. Therefore, it takes a very short time, but the use cases are limited. Pay special attention to this.
Virsh save -- bypass-Cache VM2/opt/vm2_save -- running
The above command saves the current status of VM2 to the/opt/vm2_save file. I have read this file, 597 M.
-- The running parameter indicates that VM2 can be automatically started when the next restore returns.
This command will disable VM2.
You can do some basic work before saving. For example, set ssh-authenticated password-less access first, set apt-Cache proxy, and upgrade the system to the latest version. Install Emacs. These will be available at the next restoration.
Restore now:
Virsh destroy vm2virsh restore/opt/vm2_save -- bypass-Cache -- running
You must first disable the VM.