What Is Disaster Recovery?
A disaster recovery (DR) plan defines how you restore your services after a catastrophic failure — server crash, data corruption, ransomware, or hardware failure.
Recovery Objectives
| Metric | Definition | Example |
|---|---|---|
| RTO | Recovery Time Objective — max acceptable downtime | 4 hours |
| RPO | Recovery Point Objective — max acceptable data loss | 1 hour |
Backup Strategy (3-2-1 Rule)
- 3 copies of your data
- 2 different storage types
- 1 offsite copy
Essential Components
1. Automated Backups
# Daily database backup
0 2 * * * /usr/local/bin/db-backup.sh
# Daily file backup
0 3 * * * restic -r s3:backup-bucket/myserver backup /var/www /etc2. Configuration as Code
Store server configuration in version control:
- Nginx/Apache configs
- Application environment files (encrypted)
- Cron job definitions
- Firewall rules
3. Documentation
- Server specifications and provider details
- DNS records and registrar info
- Software versions and dependencies
- Restore procedures (step-by-step)
Testing Your DR Plan
A backup that has never been tested is not a backup. Schedule quarterly DR drills:
- Spin up a new server
- Restore from backups
- Verify the application works
- Document any issues
Quick Recovery Checklist
- Provision a new VPS
- Restore configuration files
- Restore application code
- Restore database from backup
- Update DNS to point to new server
- Verify SSL certificates
- Test all critical functions