🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Backup Strategies That Actually Work: Protecting Your Data

Backup Strategies That Actually Work: Protecting Your Data

The True Cost of Data Loss

Data loss isn't a matter of if, but when. Hardware fails. Ransomware attacks. Human error deletes critical files. Without proper backups, these events can be catastrophic. With proper backups, they're merely inconvenient.

This guide covers backup strategies that work in real-world scenarios, not just in theory.

The 3-2-1 Backup Rule

The gold standard for backup strategy:

  • 3 copies of your data (original + 2 backups)
  • 2 different media types (SSD, HDD, tape, cloud)
  • 1 offsite copy (geographically separated)

Modern variation adds:

  • 1 copy that's immutable (can't be modified or deleted)
  • 0 errors verified through regular restore testing

Backup Types

Full Backup

Complete copy of all data.

  • Pros: Simple restore, complete snapshot
  • Cons: Time and storage intensive
  • Use case: Weekly or monthly base backup

Incremental Backup

Only changes since last backup (any type).

  • Pros: Fast, minimal storage
  • Cons: Restore requires full chain
  • Use case: Daily backups between fulls

Differential Backup

Changes since last full backup.

  • Pros: Faster restore than incremental
  • Cons: Grows over time
  • Use case: Balance between full and incremental

Linux Backup Tools

rsync - File Synchronization

# Basic backup
rsync -avz --delete /source/ /backup/

# Remote backup over SSH
rsync -avz -e ssh /data/ user@backup-server:/backups/

# With exclusions
rsync -avz --exclude='*.log' --exclude='cache/' /data/ /backup/

Restic - Modern Backup Tool

# Initialize repository
restic init --repo /backup/restic-repo

# Create backup
restic backup /data --repo /backup/restic-repo

# Incremental, encrypted, deduplicated by default
# To S3-compatible storage:
restic -r s3:s3.amazonaws.com/bucket-name backup /data

BorgBackup - Deduplicating Backup

# Initialize repository
borg init --encryption=repokey /backup/borg-repo

# Create backup
borg create /backup/borg-repo::backup-{now} /data

# With compression
borg create --compression zstd /backup/borg-repo::backup-{now} /data

Database Backup Strategies

PostgreSQL

# Logical backup (portable, slow for large DBs)
pg_dump -Fc dbname > backup.dump

# Full cluster backup
pg_dumpall > full_backup.sql

# Continuous archiving (Point-in-Time Recovery)
archive_mode = on
archive_command = 'cp %p /backup/wal/%f'

MySQL/MariaDB

# Logical backup
mysqldump --single-transaction --routines --triggers dbname > backup.sql

# Binary backup with XtraBackup
xtrabackup --backup --target-dir=/backup/

Cloud Backup Solutions

Object Storage Backup

# AWS S3
aws s3 sync /data s3://backup-bucket/data/ --storage-class GLACIER

# With versioning enabled for history
aws s3api put-bucket-versioning \
  --bucket backup-bucket \
  --versioning-configuration Status=Enabled

Immutable Backups

Protect against ransomware with immutable storage:

# S3 Object Lock
aws s3api put-object-lock-configuration \
  --bucket backup-bucket \
  --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":30}}}'

Automation with Cron

# /etc/cron.d/backup
# Daily incremental at 2 AM
0 2 * * * root /scripts/backup-incremental.sh

# Weekly full on Sunday at 3 AM
0 3 * * 0 root /scripts/backup-full.sh

# Monthly archive on 1st at 4 AM
0 4 1 * * root /scripts/backup-archive.sh

Testing Your Backups

A backup is only as good as its last successful restore test.

Automated Restore Testing

#!/bin/bash
# Monthly restore test
RESTORE_DIR="/tmp/restore-test"

# Restore latest backup
restic restore latest --target "$RESTORE_DIR"

# Verify file count and checksums
ORIGINAL_COUNT=$(find /data -type f | wc -l)
RESTORED_COUNT=$(find "$RESTORE_DIR" -type f | wc -l)

if [ "$ORIGINAL_COUNT" -eq "$RESTORED_COUNT" ]; then
    echo "Restore test PASSED"
else
    echo "Restore test FAILED" | mail -s "Backup Alert" admin@example.com
fi

rm -rf "$RESTORE_DIR"

Backup Checklist

  • ☐ Follow 3-2-1 rule
  • ☐ Encrypt backups at rest
  • ☐ Automate backup schedule
  • ☐ Include offsite/cloud copy
  • ☐ Test restores monthly
  • ☐ Document recovery procedures
  • ☐ Monitor backup job success
  • ☐ Retain backups per policy

Conclusion

Backups are insurance for your data. Invest time now to build a robust backup strategy, and you'll be prepared when disaster strikes.

Our backup and recovery eBooks provide comprehensive guidance on building enterprise-grade backup solutions.

Share this article:

Stay Updated

Subscribe to our newsletter for the latest tutorials, tips, and exclusive offers.