Backing up libvirt/KVM virtual machines using BorgBackup

A bash script for backing up libvirt/KVM virtual machines using BorgBackup with automated snapshot management.

Features

  • Snapshot or suspend mode: Choose between creating external snapshots or suspending VMs during backup
  • BorgBackup integration: Deduplicated, compressed backups with efficient storage
  • Flexible retention: Configurable daily, weekly, and monthly backup retention
  • Environment-based config: All settings in external .env files
  • VM state handling: Works with both running and shut off VMs
  • Atomic operations: Safe snapshot creation and automatic cleanup

Github Repo