I am using KVM, and use/manage my VMs with virt-manager. But I asked myself this question: how can create or revert some snapshot?
I'm giving examples for qcow2 disk images and commands are made with virsh.
Internal Disk Snapshots
You can list available VM with virsh in order to know their name:
Then you can check if there already is existing shapshots for this VM:
Next there is two possibilities to make a snapshot:
- create a XML snapshot description file to specify the name and description of the snapshot
- or let libvirt choose a name and no description
The XML snapshot description file must look like the following:
Make a snapshot with an XML file:
Or make a snapshot without description file:
Note: this is much more faster to make a snapshot while the VM is stoped. But it's also possible to make a snapshot while the VM is running even if it's more slow.
If you want to see some informations about the VM and snapshots you can run:
To revert the VM to a snapshot, for example run: