Infrastructure

Backing up a Proxmox cluster with PBS: deduplication, retention and ransomware protection

A practical guide to building an enterprise-grade backup policy with Proxmox Backup Server. zstd compression, a multi-level retention grid, deletion protection and an automatic audit of forgotten VMs through the pvesh API.

Backing up a Proxmox cluster with PBS: deduplication, retention and ransomware protection
Contents (16 sections)
  1. PBS client/server architecture
  2. Source-side deduplication: why PBS is hard to beat
  3. Compression: zstd versus lzo and gzip
  4. Zstandard (zstd)
  5. LZO (legacy)
  6. GZIP (legacy)
  7. Multi-level retention policy
  8. keep-last
  9. keep-daily
  10. keep-weekly
  11. keep-monthly
  12. keep-yearly
  13. Protection against deletion
  14. Automatic audit of VMs without backups
  15. The 3-2-1 strategy applied to PBS
  16. Conclusion

When you leave the big US tech platforms to host things yourself, you are not only leaving their application services: you are also leaving their resilience infrastructure. No more transparent multi-zone replication, no more free 30-day versioning, no more one-click “restore the state from two weeks ago” button. All of that has to be rebuilt, and that is exactly what Proxmox Backup Server (PBS) lets you do, with engineering that stands comparison with the commercial providers.

This article breaks down the PBS architecture and gives the exact parameters for a backup policy that withstands the three main disaster scenarios: hardware failure, application corruption and ransomware attack.

PBS client/server architecture #

PBS is not a simple periodic dump. It is a dedicated server (a VM or a separate physical server) that talks to the Proxmox cluster over an optimised protocol. The flow is as follows: the PVE client splits the VM disks into fixed-size blocks, computes a hash of each block, and sends the PBS server only the blocks not yet present in the datastore. Blocks are compressed with Zstandard, then encrypted on the client side if the key is enabled, before crossing the network.

  • Client side (Proxmox VE): proxmox-backup-client, built into vzdump since PVE 7. Nothing extra to install.
  • Server side (PBS): a dedicated Debian instance with one or more ZFS or ext4 datastores. Ideally on separate hardware.
  • Protocol: multiplexed HTTP/2 over TLS, authenticated by API token or user credentials.
  • Datastore: a structured directory that stores the chunks (deduplicated blocks) and the per-snapshot indexes. Growth stays under control thanks to global deduplication.
Diagram of the Proxmox Backup Server backup flow: the PVE client splits blocks, deduplicates, compresses with zstd, encrypts and sends them to the PBS datastore
The PBS flow: splitting into chunks, source-side deduplication, multi-threaded zstd compression, client-side encryption, then transfer to the datastore.

Source-side deduplication: why PBS is hard to beat #

Deduplication is not a compression option: it is what makes backing up 20 similar Debian VMs take up the space of just one in the datastore. In practice, on a typical cluster of 10 Linux VMs + 3 Windows VMs, the deduplication ratio observed in production is between 5× and 12×, meaning you store 100 GB on the PBS server for what would take 600 GB with naive backups.

Better still, deduplication is global across the datastore. So a new VM cloned from an existing one takes up almost nothing in its first backup: only the blocks actually changed since the template.

Compression: zstd versus lzo and gzip #

PBS has used Zstandard by default since its first release. Compared with the options inherited from vzdump (lzo, gzip), zstd wins on all three counts at once.

Zstandard (zstd) #

  • Speed: extremely fast, with throughput close to an uncompressed disk copy.
  • Multi-threading: native. Uses as many CPU cores as are available.
  • Compression ratio: excellent, better than lzo, close to gzip at an equivalent level.

LZO (legacy) #

  • Speed: moderate.
  • Multi-threading: no.
  • Compression ratio: low. Avoid it unless you have very old hardware.

GZIP (legacy) #

  • Speed: slow.
  • Multi-threading: no.
  • Compression ratio: high, but the CPU cost makes backups very long.

Multi-level retention policy #

PBS implements a five-level retention grid that covers any historical compliance need without filling up the storage. The basic rule: keep many recent snapshots, and fewer and fewer as you go back in time.

keep-last #

  • Role: immediate protection before or after critical updates.
  • Recommended value: 3 to 5.
  • Coverage: a few hours to a few days depending on backup frequency.

keep-daily #

  • Role: daily window for fine-grained restores.
  • Recommended value: 13.
  • Coverage: two full weeks, day by day.

keep-weekly #

  • Role: weekly history.
  • Recommended value: 8.
  • Coverage: two calendar months.

keep-monthly #

  • Role: a year of coverage for compliance needs.
  • Recommended value: 11.
  • Coverage: a full year, month by month.

keep-yearly #

  • Role: long-term archive.
  • Recommended value: 9.
  • Coverage: up to 10 years, for legal compliance or cold archiving.
PBS retention timeline: last 3, 13 daily, 8 weekly, 11 monthly, 9 yearly, covering a few hours to 10 years
The default retention grid covers a few hours to 10 years with fewer than 50 snapshots kept per VM.

Protection against deletion #

Modern ransomware no longer just encrypts production data: it actively looks for backup servers on the network to erase snapshots before demanding a ransom. PBS has two mechanisms that can be combined to block this scenario.

The first is the .protected sentinel file placed in a backup group: as long as it exists, PBS refuses any delete operation on that group's snapshots, including from the admin interface. The second is fine-grained permission management per API token: a PVE client only has the Backup right, never the Datastore.Modify right.

Bash
# Protect a backup group against any deletion
touch /mnt/datastore/backups/vm/100/.protected

# Check the permissions of the token used by the PVE client
proxmox-backup-manager user list-tokens backup@pbs
# The token must have only the Datastore.Backup role

Automatic audit of VMs without backups #

The main risk in a backup policy is not a software bug. It is the VM created at 11 pm on a Tuesday that never gets added to the backup pool and that you discover three months later, in the middle of an outage. The Proxmox API exposes an endpoint dedicated to this check.

Bash
# List all VMs and CTs with no scheduled backup
pvesh get /cluster/backup-info/not-backed-up --output-format json

# Typical output:
# [{"vmid":"105","type":"qemu","name":"web-staging"},
#  {"vmid":"203","type":"lxc","name":"redis-cache"}]

This command fits into a daily cron job that parses the JSON output and automatically adds the machines it finds to a dedicated backup job called NewVMs. No VM slips through the net.

Bash
#!/bin/bash
# /usr/local/sbin/audit-backups.sh - run as a daily cron job
ORPHANS=$(pvesh get /cluster/backup-info/not-backed-up --output-format json)
COUNT=$(echo "$ORPHANS" | jq 'length')
if [ "$COUNT" -gt 0 ]; then
  echo "$COUNT VM/CT sans sauvegarde detectees" | mail -s "[PVE] Audit backup" admin@exemple.fr
  echo "$ORPHANS" | jq -r '.[].vmid' | while read VMID; do
    pvesh set /cluster/backup/NewVMs --vmid "+$VMID"
  done
fi

The 3-2-1 strategy applied to PBS #

The universal backup rule still holds: 3 copies of the data, on 2 different media, 1 of them offsite. With PBS, it looks like this.

  • Copy 1: the production data on the VM disks.
  • Copy 2: the local PBS datastore on ZFS with daily snapshots (the first line of defence against corruption).
  • Copy 3: a second, remote PBS (a VPS with a sovereign hosting provider) that pulls the backups every night through the PBS sync-job mode.
  • Offline bonus: an encrypted external USB disk on a monthly rotation, physically taken offline to another location. Completely immune to network attacks.

Conclusion #

PBS is not an optional module: it is the piece that makes infrastructure sovereignty genuinely comparable with what the big platforms promise. Without it, you have a fragile private cloud. With it, you have a private cloud that survives failures, mistakes and attacks.

Setting it up properly takes about a day, and that time pays for itself at the first incident, which always comes sooner than you think. To go further on the underlying infrastructure, the LVM to ZFS guide shows how to enable replication between nodes, combining resilience through backups with resilience through redundancy.

About
01/Read nextThree articles

Related articles

Infrastructure

Exploit foundries: your firewall has become the front line

Two undergraduates in Changsha ran an automated pipeline that decrypts firmware, decompiles it through thousands of calls, forms hypotheses about vulnerabilities, writes the exploit and tests it in a lab, in a loop, day and night. More than a dozen unknown vulnerabilities in a month on network devices, some fifty organisations targeted, thirteen collection agents on a scheduled task. What this means for an SME's inventory.

cybersecurityvulnerability
Infrastructure

Intermittent SERVFAIL: the orphaned DS record that broke 15% of lookups

A CI pipeline failing intermittently, two different error messages, an obvious suspect that had nothing to do with it, and an invisible cause: a DNSSEC record still published at the parent while the zone was no longer signed. Post-mortem of a nasty DNS failure, with the method that finally settled it.

dnssecdns
Infrastructure

Patching 36 servers without unattended-upgrades

There are three doctrines: do nothing, automate everything blindly, or look first and then decide. We removed unattended-upgrades from the whole fleet and dismantled our own automatic patching with Ansible, in favour of a “visibility first” doctrine backed by PatchMon. Why, how, and the routine that goes with it.

patch managementpatchmon

What next

Infrastructure that is managed and monitored day and night?

Bastion, SIEM, patches applied on purpose, tested backups: what we apply for our clients. First conversation free.

Discuss your project

Reply within 24 working hours, from one of the two founders. Or by phone: +33 7 59 96 14 99.