aruhier / virt-backup

Backup your kvm guests managed by libvirt
Other
106 stars 23 forks source link

Help: Do I run this as a user ? #52

Closed g0lgs closed 4 days ago

g0lgs commented 7 months ago

I am trying to test this to see if it suits my purpose.

However the docs DO NOT seem to tell me if this should be run as root (which appears to be the case on my Ubuntu 22.04)

or as a user - for me I just get errors accessing files and other issues (some of which required me to edit the XML to get the VM working again as the source image path got changed from .gcow2 to a timestamp).

g0lgs commented 7 months ago

For some reason that I don't understand even running as root the backup failed (I think due to lack of disk space on thehost) and I ended up with the VM paused and I had trouble getting it to resume.

I now see that the disk settings for my VM have been changed to:

image

Which I don't understand.

<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/ubuntu22.04.1709111179"/>
  <backingStore type="file">
    <format type="qcow2"/>
    <source file="/var/lib/libvirt/images/ubuntu22.04.qcow2"/>
    <backingStore/>
  </backingStore>
  <target dev="vda" bus="virtio"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>

virt-manger does not show any snapshots so what is 'ubuntu22.04.1709111179' ?

aruhier commented 6 months ago

Sorry for the delay.

Try to run virt-backup clean to cleanup the failed backup, and merge the snapshot with your main image. I don't think that virt-manager lists external snapshots.

If it doesn't work, you can use virsh blockcommit to merge everything under a single image: https://libvirt.org/kbase/merging_disk_image_chains.html#consolidating-an-entire-disk-image-chain-into-a-single-image

About the root question: you indeed need to have access to the images in libvirt, and also have enough permissions on libvirt API to trigger a snapshot and a blockcommit. It does not have to be root, but can be the libvirt user, though I didn't test it.

g0lgs commented 6 months ago

I used a different backup script in the end