Backups and recovery
A backup you have never restored is a wish, not a copy.
- Keep three copies on two media types with one off-site.
- Keep at least one copy immutable to survive ransomware.
- Encrypt backups at rest and in transit.
- Run regular restore drills and record the steps.
In plain English
The 3-2-1 rule says keep at least three copies of your data, on two different types of storage, with at least one copy off-site, so a single device failure or disaster does not destroy everything. An immutable copy is a backup that cannot be changed or deleted for a set period, which protects it from ransomware, the kind of attack that encrypts your files and demands payment for the key. Encryption protects backup data while it is stored and while it travels, so someone who steals the backup cannot read it without the key. A restore drill is a planned test where you actually recover data from a backup, proving the copy is complete and the process works before you need it in a real emergency. Because restoring is the only part that matters, you should treat an untested backup as if it does not exist.
Step by step
- 1List the data that would hurt to lose and where it lives.
- 2Set up three copies across two storage types, with one copy off-site.
- 3Enable encryption on your backups and store the key separately from the copies.
- 4Make at least one copy immutable so ransomware cannot reach it.
- 5Run a restore into a temporary location and confirm the data is usable.
restic -r /mnt/backups init
restic -r /mnt/backups backup /var/lib/postgres
restic -r /mnt/backups snapshots
restic -r /mnt/backups restore latest --target /tmp/restoreCommon mistakes
- A backup on the same disk as the original disappears along with it when that disk fails.
- Skipping restore drills means discovering too late that the backup is incomplete or the process no longer works.
- Storing the encryption key next to the encrypted backup lets a thief unlock everything in one find.
- A backup that ransomware can reach and encrypt is just one more file the attacker locks up.
Restore from a snapshot
Write the shell command to restore the latest snapshot of a repository into a temporary directory.
restic -r /mnt/backups restoreWhat does the 3-2-1 rule mean?
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Lock in what you just learned.
Mark this lesson complete to save your place and move one step closer to the certificate.