Op 11-06-2020 om 19:09 schreef Daniel P. Berrangé: > On Thu, Jun 11, 2020 at 05:45:46PM +0200, Paul van der Vlis wrote: >> Hello, >> >> I am looking for a way to migrate a VM live to another location. >> >> The qcow2 images are now on /data , but I want to move some of them to a >> volume mounted on /data2 what's faster. >> >> Is this possible without downtime? > > Yes, you don't need to use live migration for this even. > > The "blockcopy" command can be used to copy contents of a VMs current > disk into a new file. If you use the "--pivot" arg, then QEMU will > switch to using the new file too. Thank you for this information! > eg something like this: > > $ virsh blockcopy rhel8x86_64 --transient-job --pivot \ > --path /var/lib/libvirt/images/orig.img \ > --dest /var/lib/libvirt/images/new.img Hmm, I think I use an older version (3.0) what does not have the "--transient-job" option. What I did now is this: virsh dumpxml kvm25 > /home/paul/kvm25.xml virsh undefine kvm25 virsh blockcopy kvm25 --pivot --verbose --format=qcow2 \ --path /data/kvm25.qcow2 \ --dest /data2/kvm25.qcow2 virsh dumpxml kvm25 > /home/paul/kvm25.xml2 virsh define /home/paul/kvm25.xml2 This all looks nice. The only thing I did not like is that the username and group of /data/kvm25.qcow2 is still "libvirt-qemu". Normally this changes to "root" when the image is not in use. But not in this case. What I found interesting is that the destination file is a bit smaller then the original file. Maybe it does some clean-up? root@kvms12:/data# ls -l /data/kvm25.qcow2 -rw-r--r-- 1 libvirt-qemu libvirt-qemu 11531190272 jun 12 00:41 /data/kvm25.qcow2 root@kvms12:/data# ls -l /data2/kvm25.qcow2 -rw------- 1 libvirt-qemu libvirt-qemu 11277369344 jun 12 01:05 /data2/kvm25.qcow2 root@kvms12:/home/paul# diff /home/paul/kvm25.xml /home/paul/kvm25.xml2 34c34 < <source file='/data/kvm25.qcow2'/> --- > <source file='/data2/kvm25.qcow2'/> > If the file doesn't already exist, libvirt will create it. Having > said that I'm not sure if it preserves format. So might need to > pre-create files if you're using qcow2. Test it on a throw-away > guest disk first ... I've used "--format=qcow2" and I think that does the trick ;-) I did not create an image on the destination. With regards, Paul van der Vlis -- Paul van der Vlis Linux systeembeheer Groningen https://www.vandervlis.nl/