simple tool to back up libvirt/KVM/qemu VM (lvm backed) to PBS

Jul 1, 2024
5
0
6
pbs-libvirt: libvirt/KVM guests on LVM → Proxmox Backup Server, as PVE-restorable vm/ snapshots

https://codeberg.org/DuncanRobertson/pbs-libvirt

A small Python script (stdlib only) that backs up libvirt guests with raw LVM disks to PBS, using the same vm/ layout Proxmox VE
writes: drive-*.img.fidx plus a qemu-server.conf. PBS dedup, compression and encryption work as normal.

Backup: guest-agent fsfreeze, LVM snapshot, thaw, then proxmox-backup-client uploads the snapshot. There's no dirty-bitmap support,
so every run reads each disk in full, but only changed chunks are uploaded. Restore writes the images back to LVM and can define the
domain.

Because the format is PVE's own:
- Proxmox VE can restore these backups directly (qmrestore or the GUI), and file restore works.
- pbs-libvirt can restore PVE's own VM backups into libvirt, converting the config to domain XML.
So it also works as a fairly easy bridge for moving guests between the two, in either direction.

Very lightly tested. Tested with:
- Ubuntu 22.04 host (libvirt 8.0 / QEMU 6.2)
- Raw thick LVM, a few Linux guests
- proxmox-backup-client 4.1.1, PBS 4.2.8, PVE 9.2.20
Not supported: qcow2 or file-backed disks, LVM thin pools, EFI vars. Windows guests and the systemd timer are untested. Licence:
AGPL-3.0, no warranty.