Backup, DRP, DRS

Backup, Disaster Recovery Planning (DRP), and Disaster Recovery Sites (DRS) ensure data persistence and service availability in the face of hardware failures, human errors, natural disasters, and cyberattacks.

Backup Fundamentals

A backup is a copy of data stored separately from the primary location, enabling restoration after data loss.

Backup Types

  • Full backup: Complete copy of all data. Simplest to restore, largest storage requirement.
  • Incremental backup: Only data changed since the last backup (any type). Fast backup, slower restore.
  • Differential backup: Only data changed since the last full backup. Medium backup speed, medium restore speed.

Backup Strategies

  • 3-2-1 Rule: 3 copies of data, on 2 different media, 1 offsite.
  • Grandfather-father-son: Rotation scheme with daily, weekly, and monthly backups.
  • Snapshot: Point-in-time copy of a filesystem or volume (LVM, ZFS, Btrfs, cloud storage).

Linux Backup Tools

rsync -a /data /backup/data                          # Mirror backup
tar czf backup.tar.gz /data                          # Compressed archive
borg init /backup/borg                                # Borg backup repo
borg create /backup/borg::$(date +%Y-%m-%d) /data     # Create archive
restic backup /data                                   # Restic backup

Database Backups

pg_dump mydb | gzip > mydb.sql.gz                     # PostgreSQL logical backup
mysqldump mydb | gzip > mydb.sql.gz                   # MySQL logical backup
mongodump --db=mydb --out=/backup/mongodb             # MongoDB logical backup

Disaster Recovery Planning (DRP)

A DRP is a documented strategy for recovering IT systems after a disaster.

DRP Components

  • Business Impact Analysis: Identify critical systems and maximum tolerable downtime.
  • Recovery Time Objective (RTO): Maximum acceptable downtime.
  • Recovery Point Objective (RPO): Maximum acceptable data loss (time since last backup).
  • Incident Response Procedures: Step-by-step recovery instructions.
  • Contact List: Who to call, in what order.
  • Testing Schedule: Regular drills to validate the plan.

RTO vs RPO

Scenario RTO RPO
Critical financial system 1 hour 15 minutes
Internal wiki 24 hours 24 hours
Development environment 72 hours 1 week

Lower RTO/RPO requires more investment in redundancy and backup infrastructure.

Disaster Recovery Sites (DRS)

A DRS is an alternative location for IT operations during a primary site outage.

DRS Options

  • Cold site: Facility with power, cooling, and network, but no equipment. Lowest cost, highest RTO.
  • Warm site: Pre-configured equipment, ready to receive data. Medium cost, medium RTO.
  • Hot site: Fully operational duplicate facility with real-time data replication. Highest cost, lowest RTO.
  • Pilot light: Minimal core infrastructure running, scaled up during disaster.

Cloud as DRS

Cloud providers enable rapid provisioning of disaster recovery infrastructure:

  • AWS: Backup to S3, cross-region replication, EC2 failover.
  • Azure: Azure Backup, Site Recovery, geo-redundant storage.
  • GCP: Cloud Storage, Persistent Disk snapshots, Cloud DNS failover.

High Availability (HA)

HA architectures minimise downtime through redundancy:

  • Load balancing: Distribute traffic across multiple instances.
  • Failover: Automatic switch to standby systems.
  • Clustering: Multiple systems acting as one (Pacemaker, Corosync).
  • Replication: Synchronous or asynchronous data replication.

Testing

Backup and DRP effectiveness must be tested regularly:

  • Restore tests: Verify backups can be restored.
  • Failover drills: Validate recovery procedures.
  • Chaos engineering: Intentionally introduce failures to test resilience.