Carson Reinke's Headshot

Carson Reinke's (πŸš—β˜€β˜”πŸ”‘) Blog

Moving images for libvirt/qemu

I had to do this and wanted to share how to do this, as it was actually pretty easy.

By default, libvirt images are placed in /var/lib/libvirt/images.Β  There will be an image file and a backing file(s), both will have extension .img.Β  Move all these files and copy the backing files to the new location.

Next, modify the configuration file, on my system this was location under /etc/libvirt/qemu.Β  Change location of the file attribute of element source to your new location.

Last, use qemu-img to change the backing file to the new location.Β  You can do this by using qemu-img rebase -b [backing file] [image file].Β  After that, you can remove the backing files under /var/lib/libvirt/images.