How to Set a Backup Retention Policy That Balances Cost and Risk
A backup retention policy is a written rule for how many copies you keep, how long each copy lives, and where each copy sits. The answer most small teams land on is a tiered policy: a few hourly or daily restore points for mistakes, a week or two of dailies for slow-burning problems, and a longer monthly or quarterly tail for ransomware and legal needs, with at least one copy immutable and off the main account.
Retention is where backup cost and backup usefulness fight each other. Keep everything forever and you pay for storage you will never read. Keep too little and the one thing you need is the version that was already overwritten. The policy is the contract that decides this in advance, so you are not making the call at the worst possible moment.
Work out your recovery points before you touch a config file
Every backup tool has two numbers that matter, and they are not the same. The recovery point objective (RPO) is how much data you can afford to lose, which sets your backup frequency. The recovery time objective (RTO) is how long a restore may take, which sets where the copies live and how fast the storage is. Retention is downstream of both. If you back up hourly but only keep one day, you have a very short RPO and almost no protection against a mistake that goes unnoticed for two days.
Think in failure modes rather than in file counts. A bad deploy or a fat-fingered rm needs a restore point from minutes or hours ago. A corrupted database or a slow data-quality problem needs one from days or weeks ago. Ransomware needs a copy that the attacker could not reach and could not encrypt, from before the intrusion started. Those three needs pull in different directions, which is why a single retention number is usually wrong.
Keep generations, not a pile of full copies
If you are using a tool that does full and incremental backups, retention is really about generations. A common shape is a daily incremental chain with a weekly full, then keeping a handful of weeklies and a couple of monthlies. With deduplicating or snapshot-based tools the storage cost of keeping more versions is much lower than the naive full-plus-incrementals model, so you can afford a longer tail. Check what your tool actually stores before you decide how expensive a long retention is.
Build the backup retention policy in layers
A workable default looks like this, and you should tune the numbers to your RPO and your risk: keep frequent short-term points for the last day or two, keep daily points for a couple of weeks, keep weekly points for a couple of months, and keep monthly points for a longer horizon that matches any compliance or contractual obligation you have. The exact counts depend on your data, but the layering is the point. Each tier answers a different question.
Most tools express this as a schedule plus a retention rule. With a snapshot-based tool the rule is often a count per tier, and with object storage it is often an age in days plus a lifecycle transition to cheaper storage. Here is the shape of a retention block you might paste into a config file, using generic directives:
[retention]
keep_hourly = 24
keep_daily = 14
keep_weekly = 8
keep_monthly = 12
prune_after_days = 400
immutable_days = 30
The immutable_days line is the one people skip. It means the backup store refuses to delete or overwrite an object until that window passes, even if the credentials asking are valid. That is what turns a backup into ransomware protection rather than just a copy. If your storage supports object lock or a write-once bucket policy, use it, and set the lock window longer than your realistic detection time for an intrusion.
Check what is actually on disk, not what you configured
Configurations drift and jobs fail quietly. The retention policy you wrote is a claim; the list of restore points is the truth. Get in the habit of listing what exists and comparing it to the plan. With a restic-style repository the command and the shape of the output look like this:
$ restic snapshots --compact
ID Time Host Tags
a1b2c3d4 2024-05-01 02:00:00 web-01 daily
b2c3d4e5 2024-05-02 02:00:00 web-01 daily
c3d4e5f6 2024-05-08 02:00:00 web-01 weekly
d4e5f6a7 2024-06-01 02:00:00 web-01 monthly
Read that list like an auditor. Are there gaps where a job silently failed? Is the oldest copy as old as your policy promises? Is the newest copy recent enough for your RPO? Are the tagged tiers present, or did everything end up as a daily? A missing weekly or monthly is the failure that bites during a ransomware incident, because the dailies may all be inside the encrypted window.
Pruning is the other half. Once you trust the list, run the prune that enforces the rule, and run it on a schedule with logging. A prune command with a dry run first is the safe pattern, because a bad retention rule that deletes too much is itself an outage. Always confirm the dry run output before letting it delete.
Where the copies live matters as much as how many
Retention on a single account is fragile. If an attacker gets your credentials, they can delete the backups as easily as the data. The policy should state that at least one tier lives in a separate account or a separate provider, with credentials the production systems do not hold, and preferably with immutability enabled. The classic rule of three copies, on two kinds of media, with one off site, still holds; the modern addition is that one copy must be un-deletable for a window. Count your copies against that rule, not against a vague feeling of safety.
Set the backup retention policy and test it
Write the policy down in one place: the tiers, the counts, the immutability window, and where each tier lives. Put it next to the backup config so the two cannot drift apart. Then schedule a restore test that actually reads from the oldest tier, not just the newest, because the oldest copy is the one you will need when everything recent is compromised. If the restore from the monthly tier fails, your retention policy is fiction and you should fix it before adding more storage.
Start by listing your current restore points and comparing them to the tiering above. Fix the gaps first, add immutability to one off-site copy second, and only then tune the counts to save storage. The order matters: protection before optimisation. Once the policy is written and the restore test passes, revisit it on a schedule, because data volume and risk both drift over time.
