Live migration to another volume at the same host

Daniel P. Berrangé berrange at redhat.com
Thu Jun 11 17:09:53 UTC 2020


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.

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 

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 ...

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list