Skip to content

The 3-2-1 backup strategy applied to WordPress

Two copies on different media, one off-site, one cold. What that actually maps to when the workload is wp-content plus a MySQL dump.

Your WordPress production node has nightly snapshots on the same hypervisor, the JetBackup destination is the second NVMe on the same rack, and the operator calls it “redundant.” Then the hypervisor has a controller fault that corrupts both the LVM root and the secondary volume in the same window, and the only restorable copy is a quarterly dump someone keeps on a laptop. The 3-2-1 rule exists precisely to prevent this conversation in the post-mortem.

What’s happening

3-2-1 is shorthand for: three copies of the data, on two different media, with one copy off-site. Some teams extend it to 3-2-1-1-0 — one of the copies must be offline or immutable, and the restore drill must complete with zero errors. For a typical WordPress workload the three “copies” map to:

  • Copy 1 — Production live data. wp-content/ on the application volume and the live MySQL database. This is not a backup. This is the thing you’re protecting.
  • Copy 2 — Same-region warm backup. Nightly compressed archives or restic snapshots on a separate volume or a managed object store in the same region. Recovery Time Objective (RTO) for a full restore is minutes to a couple of hours. This is what the on-call engineer reaches for when a deploy corrupts the database at 2 a.m.
  • Copy 3 — Off-site cold archive. Encrypted snapshots replicated to a different region or a different provider, with a retention window measured in months. RTO is hours to a day. This is what survives a region outage, a ransomware event, or a billing dispute that closes the primary account.

“Two media” used to mean tape plus disk. In a cloud environment it means two distinct failure domains — the same S3-compatible bucket in two regions counts, the same hypervisor cluster’s local block storage twice does not. “One off-site” means a copy that is not on the same provider’s same control plane. If your primary cloud account is suspended at 03:00 UTC, your off-site copy needs to remain reachable.

The cold archive tier is where teams cut corners and where ransomware operators win. An archive that is encrypted, immutable (object lock or write-once-read-many), and accessed via a separate credential is what makes the difference between a four-hour incident and a four-week one.

How to verify

Audit the actual placement of what you call “backups” — not what the dashboard says, what df and aws s3 ls actually report:

# Primary host disk usage — is the warm backup on the same volume?
df -h /backup /home /var/lib/mysql

# Same-region warm backup — list contents, confirm last write
ls -lh /backup/<account>/archives/ | tail -10
mc ls warm/<bucket>/wordpress/<site>/ --recursive | tail -20

# Off-site cold archive — different account, different region
AWS_PROFILE=cold-archive aws s3 ls s3://<cold-bucket>/wordpress/<site>/ \
  --recursive --human-readable | tail -20

Three failure-domain checks the audit should answer in writing:

# 1. Does the warm copy share a failure domain with production?
#    Same hypervisor? Same region? Same provider account?
mount | grep /backup

# 2. Is the cold copy actually off-site?
AWS_PROFILE=cold-archive aws s3api get-bucket-location \
  --bucket <cold-bucket>

# 3. Is the cold copy immutable?
AWS_PROFILE=cold-archive aws s3api get-object-lock-configuration \
  --bucket <cold-bucket>

If get-object-lock-configuration returns ObjectLockConfigurationNotFoundError, you have a copy of the data, not an immutable archive. A credential compromise still lets the attacker delete it.

Last verification — pick a date from three months ago and try to actually restore from cold. A timed drill, with the runbook in front of you, with the keys not on the laptop you’re restoring to. If the answer to “what’s the decryption key” is “let me check Slack,” the drill failed before it started.

The fix

Map the WordPress workload to three tiers explicitly. Here’s a layout that works for a single production node with wp-content around 80 GB and a database around 6 GB:

Tier 1 — Live production. Not a backup. Listed for completeness.

  • Path: /home/<account>/public_html/wp-content/
  • Database: wp_<account> on the live MySQL
  • Snapshots of the LVM volume are operationally useful for rollback, but a corrupted parent disk takes the snapshot with it. Don’t count snapshots toward 3-2-1.

Tier 2 — Same-region warm backup, retained 14 days.

  • Nightly mysqldump --single-transaction --quick plus a restic snapshot of wp-content/
  • Destination: managed S3-compatible bucket in the same region, separate from production credentials
  • Recovery: full site restored to a staging node in 60-90 minutes

Tier 3 — Off-site cold archive, retained 12 months minimum.

  • Weekly snapshot of the latest warm backup, copied to a different region or provider
  • Bucket has object lock enabled (governance or compliance mode)
  • Credentials for cold-archive write are scoped to the backup runner only; credentials for cold-archive delete are held by a separate role that requires manual approval
  • Recovery: typically restored back to warm tier first, then to production

A concrete shell that runs nightly and weekly under cron, with restic as the engine:

#!/usr/bin/env bash
set -euo pipefail

SITE=acmewp
WARM_REPO=s3:s3.example-region.amazonaws.com/sh-warm-${SITE}
COLD_REPO=s3:s3.other-region.example.com/sh-cold-${SITE}
DB=wp_${SITE}
DUMP=/var/backups/db/${SITE}-$(date +%F).sql.gz

# 1. Database dump
mysqldump --single-transaction --quick --routines --triggers \
  --max_allowed_packet=512M ${DB} | gzip -1 > ${DUMP}

# 2. Warm tier — restic snapshot of wp-content + the SQL dump
export RESTIC_PASSWORD_FILE=/etc/restic/warm.pw
restic -r ${WARM_REPO} backup \
  /home/${SITE}/public_html/wp-content \
  ${DUMP} \
  --tag site:${SITE} --tag tier:warm

restic -r ${WARM_REPO} forget --tag tier:warm \
  --keep-daily 14 --keep-weekly 4 --prune

# 3. Cold tier (run weekly, separate cron entry) — replicate warm to cold
if [[ $(date +%u) == 7 ]]; then
  export RESTIC_PASSWORD_FILE=/etc/restic/cold.pw
  restic -r ${COLD_REPO} backup \
    /home/${SITE}/public_html/wp-content \
    ${DUMP} \
    --tag site:${SITE} --tag tier:cold

  restic -r ${COLD_REPO} forget --tag tier:cold \
    --keep-weekly 8 --keep-monthly 12 --prune
fi

The two restic repos use different passwords stored at different paths. The cold-tier IAM credentials have s3:PutObject but not s3:DeleteObject on the bucket; deletion goes through a separate role and a manual ticket. That’s what makes the cold tier ransomware-resistant — not the encryption, the credential separation plus object lock.

For the quarterly restore drill, the runbook restores from the cold tier to a fresh node, brings WordPress back up, browses the homepage, queries wp_posts for the latest row, and records the elapsed time. If any of those steps fails, you haven’t found a backup, you’ve found a regression in the backup pipeline.


Stack Harbor operates 3-2-1 backup tiers for WordPress as part of enterprise WordPress hosting — including the cold-archive credential split and the quarterly drill. If your warm and cold copies live on the same provider, let us scope the off-site tier.