I am running Kubuntu (Ubuntu + KDE) with libvirt/qemu/kvm to run VMs.
I have a Windows 11 VM. When I created it, it created a .qcow2
and now I have a snapshot file.
The original file paths were:
/var/lib/libvirt/images/win11.qcow2
(main storage)/var/lib/libvirt/images/win11.fresh-install
(snapshot)I had to move the files and now their paths are:
/data/libvirt/images/win11.qcow2
(main storage)/data/libvirt/images/win11.fresh-install
(snapshot)I can't move them back to the original place.
The VM originally pointed to /var/lib/libvirt/images/win11.fresh-install
but I updated it to point to /data/libvirt/images/win11.fresh-install
.
When I try to run the VM it says it can't find the backing file /data/libvirt/images/win11.qcow2
.
So how can I tell /data/libvirt/images/win11.fresh-install
that the backing file is in /data/libvirt/images/win11.qcow2
?
I tried the qemu-img rebase
command but it also gives the same error.
root@desk:/data/libvirt/images# qemu-img rebase -b win11.fresh-install win11.qcow2
qemu-img: Could not open new backing file 'win11.fresh-install': Could not open backing file: Could not open '/var/lib/libvirt/images/win11.qcow2': No such file or directory
root@desk:/data/libvirt/images# qemu-img rebase -b win11.qcow2 win11.fresh-install
qemu-img: Could not open 'win11.fresh-install': Could not open backing file: Could not open '/var/lib/libvirt/images/win11.qcow2': No such file or directory
Is there anyway to fix this or am I out of luck?
According to the documentation for the qemu-img rebase
command, there exist two operation modes (Safe and unsafe mode). In the default safe mode the old backing file needs to be still available at the original location. However since that is not the case for you, the unsafe mode must be chosen and you additionally need to pass the format of the backing file. So the full command could look like:
qemu-img rebase -u -b win11.fresh-install -F qcow2 win11.qcow2