Backup PVE host system with LVM snapshot?

carsb

New Member
Dec 10, 2024
7
2
3
Hello,
first I'd like to thank Proxmox team for this software product.

My homelab server currently is at beginner-level - single node, single NVMe with LVM-over-LUKS Proxmox host.
Without disk redundancy goal is to schedule automatic backups for all relevant components:
- VMs via PVE backup job
- PVE host configuration via this routine
- PVE host root filesystem via LVM snapshots

Snapshots don't protect against disk failures, but focus here is on recovery/revert in case of boot failures due to misconfiguration or PVE package update errors.

Hence my question:
Is it safe to create LVM snapshots of a running Proxmox host system with regards to data consistency and integrity?

I've read LVM ensures, that the system is readonly at snapshot creation-time on a block-level, but there *might* be issues with data consistency at the application/filesystem-level, e.g. some databases.

IIRC Proxmox uses SQLite (/var/lib/pve-cluster/config.db), hence it probably boils down to: Do SQLite + LVM snapshots work together?

Specifically for Proxmox VE, is there any systemd service to disable at snapshot creation time, to maximize data consistency (like pve-cluster in linked docs)?

Thanks for any clarifications.
 
Last edited:
Hm no opinions? :)
Snapshots would be great as safety layer in case updates go south, granted they ensure consistency.
Guess I'm fine with just backing up config then and maybe later on upgrade to ZFS...
 
The basic approach would be to create LVM snapshots before doing the actual backup of the OS ( which will also backup the sollte database) from the mounted snapshot. After the backup unmount and remove the snapshot. LVM snapshots are good if you need vonsistence for a short time like the duration of a backup job. Keeping them longer hurts performance.
You can use any Linux backup program for this ( borgbackup, proxmox-backup-client, restic). Btw: If you are a beginnen I would highly advise against following advice without fouble-checking it. The OP in linked Post and other users/Proxmox staff had quite a lot of different opinions on such matters in the past, so please do your own research and don't blindly follow experts ( or wannabe experts like me)
 
  • Like
Reactions: carsb
Thanks @Johannes S , these are good suggestions. My PVE update procedure now is:
Bash:
sqlite3 /var/lib/pve-cluster/config.db .dump > "/root/config.dump.$(date --utc +%Z%Y%m%d%H%M%S).sql"
lvcreate --size 8G --snapshot --name preupdate /dev/pve-vg/root
# Do system update and restart. If everything works fine, remove snapshot:
lvremove /dev/pve-vg/preupdate

In addition VM and config backups are automatically taken on a daily basis, which works great so far.