I've created a qcow2 image snapshot of a KVM guest image. I've modified the XML file for the image to use the new snapshot file but when I halt and restart the guest, and create a file on the guest the new snapshot file is not updated. Here are the details.
(1) Create the snapshot.
qemu-img create -f qcow2 -b /var/lib/libvirt/images/myguest.img /var/lib/libvirt/images/myguest.qcow2.snap
(2) Edit two lines in /etc/libvirt/qemu/myguest.xml
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/myguest.qcow2.snap'/>
(3) ssh to myguest and halt it.
(4) Confirm with "virsh list" that the guest is indeed no longer running."
(5) Restart the guest.
virsh start myguest
myguest.qcow2.snap was indeed created by qemu-img with an expected small size of 197K but, even if I create files in myguest the .snap file is never written to.
Best Answer
After you modify the XML file you should
That will cause
libvirtd
to detect the changes so that the nextvirsh start
will start up with the new values.