Score:1

How to move live QEMU-KVM VM without libvirt?

cm flag

Let me start by saying that I read How to (properly) back up a live QEMU/KVM VM? But it does not seem to meet my need.

I am looking for a solution to backup AND move a few QEMU-KVM VMs without stopping them. The state do not need to be perfecting preserved (i.e. I don't care about their state after backup) but the backup must not be corrupted. I have no libvirt in the setup.

I have done so far: backup a powered off VM and move it to another host. This can be done easily by copying the .qcow2 disk images. But how can I do it without powering off VMs? Can I take a snapshot and then tell QEMU to only copy up to the snapshot? The snapshot method used is internal (using the same disk image), I would like to keep it that way.

Score:0
in flag

If you want to make your life really easy and you can afford to run a testing distribution, than upgrade to Debian bookworm (it will migrate into stable at some point). That has made my QEMU/KVM life a lot easier, since bookworm comes with QEMU 6.1.

You can backup a life-VM with the simple command:

virsh backup-begin YourVM

If you have a fast disk (e.g. NVMe) that whole process will finish in less than a minute while the VM is running and not even slowing down much. You will find your Backup-VM in the default directory: /var/lib/libvirt/images/ with a Unix-timestamp added to it. Make sure you also save the YourVM.xml file in /etc/libvirt/qemu/ together with your backup for later restoration. You can simply start that image later - works like a charm for me.

You can also check the documentation here. According to the docs, backup should work with QEMU 5.2 in Debian bullseye too, but that did not work for me.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.