WordPress and Database Pattern
WordPress recovery requires filesystem state plus matching database state.
warning
Never rely on files-only backups for WordPress. If the database and uploads are out of sync, restores can be inconsistent.
What to Back Up
| Domain | Typical path | Notes |
|---|---|---|
| WordPress files | /var/www/html/ | include wp-content/ and configs you need |
| Uploads | wp-content/uploads/ | often the largest dataset |
| Database dump | backup folder | dump first, then snapshot together |
Example Job
wordpress-hybrid-backup.sh
STAMP="$(date +%F-%H%M)"
mysqldump -u wp_user -p wp_db | gzip > "/backup/db/wp-${STAMP}.sql.gz"
rsync -a --delete /var/www/html/ /backup/wp/files/current/
restic backup /backup/wp/files/current /backup/db --tag wordpress --tag daily --host wp-01
rclone sync /backup/wp/files/current remote-prod:backups/wp/files/current
When prompted, enter the database password securely.
Suggested Restore Pairing
When restoring, pick:
- the snapshot that contains the database dump you want
- the matching file state from the same snapshot
tip
Tag WordPress and database snapshots consistently so a restore can recover a matched pair.