LinuxXLVII · Backup Strategy3-2-1
3-2-1 and modern backup strategies
What you'll learn
- Apply the 3-2-1 rule
- Extend to 3-2-1-1-0 for ransomware
- Use immutable backups
- Plan air-gapped copies
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
The 3-2-1 backup rule is the standard for backup strategy. Modern variations address ransomware and supply-chain attacks. This lesson covers both.
3-2-1 rule
- 3 copies of data (production + 2 backups).
- 2 different storage media (e.g. disk and tape).
- 1 offsite copy (in a different physical location).
This protects against:
- Disk failure (one of the copies survives).
- Media corruption (different media).
- Site loss (offsite copy).
3-2-1-1-0 rule (modern)
For ransomware protection:
- 3 copies.
- 2 different media.
- 1 offsite copy.
- 1 immutable copy (cannot be modified or deleted, even by admin).
- 0 errors (tested and verified restores).
Immutable backups cannot be modified. Even if ransomware encrypts the production system, the immutable copy is safe.
Immutable online copies
Immutable means the copy cannot be deleted or overwritten for a retention period. It is still online, and that is the point: you restore from it quickly.
S3 Object Lock:
aws s3api put-object --bucket my-backup \
--key backup-2026-08-09.tar \
--body backup.tar \
--object-lock-mode COMPLIANCE \
--object-lock-retain-until-date 2026-09-09T00:00:00Z
The object cannot be deleted or modified until the retention
date. Use COMPLIANCE, not GOVERNANCE: GOVERNANCE is
bypassable by any principal holding
s3:BypassGovernanceRetention, which is exactly what a
compromised administrative role holds. GCS Bucket Lock and
Azure Blob immutable storage give the same property.
BorgBackup with append-only mode:
# On the BACKUP SERVER, in ~backup/.ssh/authorized_keys.
# One line - wrapped here for readability.
command="borg serve --append-only --restrict-to-path /backup/repo",\
restrict ssh-ed25519 AAAA...client-key... backup-client
The client can add archives but cannot prune or delete them, because the server refuses the operation.
Air-gapped copies
An air-gapped copy is offline and unreachable from the network. Options:
- Tape: rotate tapes, eject them, store one offsite.
- Disk rotation: rotate external disks, unplug them, store one offsite.
The principle: a network attacker cannot reach the air-gapped copy.
Test restore
Every backup strategy needs regular test restore:
- Quarterly: full restore drill on a non-production host.
- Annually: full DR drill including all infrastructure.
Test restore catches:
- Backup is corrupted.
- Backup is incomplete.
- Restore procedure is wrong.
- Dependencies are missing.
Cost vs duration
Different storage tiers for different retention:
| Tier | Cost / GB | Retention |
|---|---|---|
| SSD | $0.10 | 1-7 days |
| HDD | $0.03 | 1-4 weeks |
| S3 IA | $0.0125 | 1-3 months |
| S3 Glacier | $0.004 | 1-7 years |
Total: balance cost against recovery time and retention.
Knowledge check
Knowledge check · 3 questions
Q1. What does the 1 in 3-2-1-1-0 mean?
Q2. A backup strategy without test restore is complete.
Q3. Which of the following give you a copy an attacker with production admin cannot destroy? Select all that apply.
Passing score: 75%. Answers are checked in this browser.