Snapshots with Virt-Manager

Posted December 23, 2016 by Adrian Wyssmann ‐ 2 min read

My work computer runs on Windows, so whenever I quickly need a VM, I use Virtualbox or VMWare Workstation. But my home computer runs on Linux and there I use KVM/Qemu instead - yes I also could use Virtualbox but I don’t. So when I want to use these VMs or better the underlying disk images, I can use the vdi or vmdk disk as they are cause QEMU supports a bunch of different disk formats. But unfortunately I cannot create snapshots on these disk images so I need to convert them to another format. The preferred format is Qcow2

Qcow2 is an updated version of the qcow format, intended to supersede it. The main difference with the original is that qcow2 supports multiple virtual machine snapshots through a new, flexible model for storing snapshots. Users can easily convert qcow disk images to the qcow2 format.

Reference: Wikipedia

So I simply need to convert or better clone the disks. Unfortunately to convert vmdk I need to do an additional step and convert them to vdi files using VBoxManage.

[[email protected] ~]$ VBoxManage clonehd box-disk1.vmdk ubuntu.vdi --format vdi

The virtual appliance should be off. Afterwards one can convert the vdi format to qcow2 by using qemu-img convert command

[[email protected] ~]$ qemu-img convert -f vdi -O qcow2 ubuntu.vdi ubuntu.qcow2

Now you are able to create snapshots for your vms, for example in livirt-manager:

qemu snapshot creation