Open Virtualization Blog

Creating snapshots in KVM

Posted by UDS Enterprise Team |

Before upgrading a virtual machine, it is recommended to make a snapshot to be able to revert a Domain/VM to a snapshot in case an error occurs during the upgrading process. There is a command to create a snapshot of a Virtual Machine (VM) while it is running.


KVM supports both live and normal snapshots, but you should keep in mind that the snapshot must always base on qcow2 type disk and that snapshots are only supported in KVM VM Host servers, thay can't be created within KVM VM. A snapshot can also be created (disk and RAM) from arguments. In both cases, one of these commands must be used:

-qemu-img command. It should never be used to modify images in use by a running virtual machine or any other process. The machine must be always in shutdown state to use this command.

-virsh command. It is the main interface to manage virsh guest domains including KVM.

In this tutorial we're using the second alternative, virsh command.

Syntax: This command can create a snapshot from a XML file using virsh snapshot-create or directly from a set of options using dvirsh snapshot-create-as command. Syntax is: virsh snapshot-create-as --domain {VM-NAME} --name "{SNAPSHOT-NAME}"


--domain {VM-NAME}: Domain name/VM name/id/uuid

--name "{SNAPSHOT-NAME}": Name of snapshot

For more information and examples read the full article



You must authenticate to review this post