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

Jul 1, 2024
6
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.
 
Interesting project! Using the PVE-compatible backup format as a bridge between libvirt/KVM and Proxmox VE is a clever approach, especially for teams managing mixed virtualization environments.

For anyone exploring cross-platform VM migration, it's also worth considering backup solutions that support Proxmox VE backup and recovery alongside migration between different virtualization platforms. Vinchin, for example, supports Proxmox VE backup and recovery, as well as cross-platform VM migration.

One thing I'd be interested to know: have you considered adding CBT or incremental disk tracking in the future to reduce the amount of data read during each backup run?
 
  • Like
Reactions: MelbourneNerd53
that would be a nice to have - but I'm at the "amazed it works" stage - and simplicity I'm hoping means reliability for now.. for the relatively small SSD backed VMs on lvm storage I am using the extra complexity might not be worth it, for my use case.