Skip to content
xaweho

Knowledge base · intermediate

Configuring retention policies — keep-last/daily/weekly/monthly/yearly

How to configure a sensible retention for your backups — from the standard setup to strict compliance requirements.

intermediate ·

A retention policy decides how many backups you keep per VM — and how far back you can restore. The art is the balance: not too many, because storage costs money — not too few, because in an emergency you need the right snapshot.

The five retention axes

PBS supports five axes that are combined:

AxisWhat it does
keep-last NKeeps the N most recent backups, completely independent of the date
keep-hourly NKeeps one backup per hour, for the last N hours
keep-daily NKeeps one backup per day, for the last N days
keep-weekly NKeeps one backup per week (typically Sunday), for the last N weeks
keep-monthly NKeeps one backup per month, for the last N months
keep-yearly NKeeps one backup per year, for the last N years

PBS is smart about this: snapshots that satisfy several criteria at once don’t get counted twice. A Sunday backup from December 31 counts for keep-weekly as well as keep-monthly and keep-yearly.

Standard recommendation for private customers

keep-last:    3
keep-daily:   7
keep-weekly:  4
keep-monthly: 6
keep-yearly:  2

That gives you:

  • The 3 most recent backups (immediately available)
  • 7 daily backups (the state of each of the last 7 days)
  • 4 weekly ones (every Sunday of the last month)
  • 6 monthly ones (the last of the month)
  • 2 yearly ones (the last of the year)

Effectively about 17–22 snapshots per VM. With deduplicated storage, that’s far less space than “22× full backup”.

Setup for more safety (medical practices, law firms, compliance)

keep-last:    7
keep-daily:  30
keep-weekly: 12
keep-monthly: 24
keep-yearly:  7

That gives you:

  • The state of every day of the last 30 days
  • The state of every week of the last 3 months
  • The state of every month of the last 2 years
  • The state of every year of the last 7 years

Audit-ready, often required by data protection officers.

Setup for test and development VMs

keep-last:    3
keep-daily:   3
keep-weekly:  1

Very short retention — you usually only need the current state. Saves storage.

Setup for high-frequency backups

If you back up every 4 hours during the day (databases, mail servers):

keep-last:    24    # the 24 most recent = roughly 4 days at a 4h interval
keep-hourly:  6     # one per hour, last 6 hours
keep-daily:   14
keep-weekly:  4
keep-monthly: 6

keep-hourly only matters for high-frequency backups. With a daily job it’s irrelevant.

Where retention is configured

In the PVE backup job (recommended):

  1. Datacenter → Backup → select job → Edit → Retention tab
  2. Enter the values, Save.

The retention takes effect after every backup run — prune runs automatically right afterwards.

In the PBS datastore (datastore-wide):

  1. Datastore → <your-datastore> → Prune & GC
  2. Set a separate schedule + retention.

If both are set, the stricter policy wins.

Testing with dry-run

Before you set a retention live, do a dry-run:

In the GUI: Datastore → Content → <vm> → Prune (action menu) → dry-run enabled.

On the CLI:

proxmox-backup-client prune \
  vm/100 \
  --keep-daily 7 --keep-weekly 4 --keep-monthly 6 \
  --dry-run \
  --repository 12345@pbs@pbs01.xaweho.de:12345

You’ll see which snapshots would be deleted. If that looks right, run it for real without dry-run.

Protecting special snapshots

If you want to protect important snapshots from any retention:

  1. Datastore → Content → select snapshot → set the Protected checkbox.

Protected snapshots are ignored by every prune — they stay until you delete them manually.

Useful for things like:

  • “Backup before the PostgreSQL major update”
  • “State before migrating to the new server”
  • “Compliance snapshot Q4 2026”

Frequently asked questions

What’s the difference between keep-last and keep-daily? keep-last=3 keeps the three most recent backups, no matter when they were made — even if all of them happened within the last hour. keep-daily=3 keeps one backup per day for the last three days. With a daily backup job the effect is similar; with multiple backups per day the difference is big.

Combine them or use them individually? Combine. The axes don’t contradict each other — they complement each other. keep-last as a safety net, keep-daily/weekly/monthly as the timeline, keep-yearly for long-term compliance.

What if I make the retention stricter later? On the next prune run, the snapshots that no longer fit the new policy get deleted. Protected snapshots stay.

How much storage does a “long” retention need? Thanks to deduplication, less than you’d naively expect. A VM with 100 GB of data and 24 monthly snapshots typically occupies 130–180 GB in the datastore (not 2400 GB). More for frequently changing data, less for stable data.

Can different VMs have different retentions? Yes. One retention per PVE backup job. If you have one job for test VMs and one for production VMs, you can configure each job differently.

What if I set no retention at all? Then snapshots are never deleted automatically. The datastore grows and grows. Not recommended — you’d have to prune manually.

How do I see what a given retention would mean? In the PVE backup job: “Retention” tab → at the bottom you see a textual description of the current setting. PBS shows a similar hint.

What’s next

Related products
Tags
pbs retention policy prune

Did this article help?

If not, open a ticket. If it did, we're happy about a referral — both sides get €25 credit on their customer account.