Backup Restore — Cheat Sheet

Tags: backup, restore, rpo, rto, disaster-recovery, snapshot, retention

Level: intermediate

TL;DR: Essential concepts, strategies, and metrics for data preservation and disaster recovery, ensuring business continuity with minimal data loss.

Key concepts

RPO (Recovery Point Objective): Maximum acceptable amount of data loss measured in time.

RTO (Recovery Time Objective): Maximum acceptable downtime before the system is completely restored.

Full Backup: Complete copy of all data; slow to create but fast to restore.

Incremental Backup: Copies data changed since the last backup. Fast to create, slower to restore.

Differential Backup: Copies data changed since the last full backup. Balances creation and restoration time.

Snapshot: Point-in-time storage state. Not a true independent backup unless replicated externally.

3-2-1 Rule: 3 copies of data, 2 different media types, 1 offsite location.

Retention Policy: Rules defining exactly how long backups are kept before scheduled deletion.

Immutability: Read-only backups that cannot be altered, providing robust defense against ransomware.

Typical questions and ready answers

Q: How do you decide between incremental and differential backups?A: I evaluate the RTO and storage costs. Incremental saves space and runs faster daily, but differential makes the restoration process much faster.

Q: What is the difference between a snapshot and a backup?A: A snapshot is a quick local state reference. I use true backups for independent copies stored on separate hardware for actual disaster recovery.

Q: How do you ensure backups are actually reliable?A: I implement automated, regular restoration tests. A backup is only reliable if it can be successfully restored within the defined RTO.

Pitfalls and common mistakes

Never testing the restoration process until an actual disaster occurs.

Storing backups on the same physical infrastructure as the production data.

Failing to encrypt backups, leaving sensitive data exposed to unauthorized access.

Ignoring silent failures by not actively monitoring automated backup jobs.

Snippets and commands

# PostgreSQL logical backup
pg_dump -U username -F c -f db_backup.dump dbname

# PostgreSQL restore from logical backup
pg_restore -U username -d dbname -1 db_backup.dump

# Rsync command for incremental file backup
rsync -av --delete /source/directory/ /destination/directory/

To review

[ ] Cloud-native backup solutions and lifecycle policies

[ ] Database point-in-time recovery (PITR) procedures

Jarvis Interviews
Jarvis