A reseller calls you in a panic: a customer’s site has been showing the WordPress “There has been a critical error” message for two days, the customer wants a restore from before the issue started, and you discover that DirectAdmin’s admin-level backup cron has been silently failing for six weeks because /home/admin-backups filled the disk. The newest “backup” on the server is older than the bug. This is a normal failure mode for DirectAdmin backups — they’re enabled by default, mostly work, and have no monitoring around them until something forces you to look.
What’s happening
DirectAdmin ships with two distinct backup systems and they confuse people because they’re both called “backup”:
- Admin-level backups — driven from “Admin Backup / Transfer” in DirectAdmin, run by
/usr/local/directadmin/scripts/cron_dailyor via a manual cron, dump full account backups (data + DB + DNS + mail) into a directory (default/home/admin_backups/) or push them to FTP/SFTP/SCP/S3 endpoints. Used by the host operator for fleet-level DR. - User-level backups — the per-account “Create Backup” feature inside the user’s panel, controlled by the
backupfeature toggle in their package. The user picks what to include; the resultingbackup-*.tar.gzlands in their~/backups/directory and they download it themselves.
Each one has its own failure modes. Admin backups fill disks because they’re additive by default (DirectAdmin keeps “all previous backups” unless you set backup_gzip rotation explicitly). User backups never get touched because users don’t think about it. And neither is verified — DirectAdmin will happily write a 200-byte truncated tarball when the home directory ran out of inodes mid-archive, with no signal that the resulting “backup” can’t be restored.
The discipline you want has four parts: admin backups go off-site via rclone with explicit retention, user backups are disabled by default and only enabled per package, both have monitoring that paged you when the last successful run was over 25 hours ago, and you do a restore drill once a quarter.
How to verify
DirectAdmin backup configuration lives in /usr/local/directadmin/data/admin/admin-backup/conf.d/. List the active jobs:
ls /usr/local/directadmin/data/admin/admin-backup/conf.d/
# 2026-04-30-0200.conf
# weekly-tuesday.conf
Each .conf file describes one schedule:
cat /usr/local/directadmin/data/admin/admin-backup/conf.d/weekly-tuesday.conf
# minute=0
# hour=2
# dow=2
# users=all
# what=domain,subdomain,email,emailsettings,forwarder,autoresponder,vacation,list,ftp,database,database_data,trash
# where=ftp
# ftp_ip=backup.example.com
# ftp_username=backup-user
# ftp_password=<encrypted>
# ftp_path=/da-backups
# enabled=yes
Check the most recent backup run log:
tail -200 /var/log/directadmin/cronjob.log | grep -E '(backup|tarball|cron_daily)'
Check the actual on-disk state of admin backups:
du -sh /home/admin_backups/ 2>/dev/null
find /home/admin_backups/ -type f -name '*.tar.gz' -mtime -2 | wc -l
find /home/admin_backups/ -type f -name '*.tar.gz' -mtime +30 | wc -l
The first number tells you how much disk you’re spending on backups, the second how many backups from the last two days, the third how many are older than 30 days (i.e. retention is broken).
Test that a recent backup is a valid tarball, not a truncated write:
for f in $(find /home/admin_backups/ -name '*.tar.gz' -mtime -1); do
if gzip -t "$f" 2>/dev/null && tar -tzf "$f" >/dev/null 2>&1; then
echo "OK $f"
else
echo "CORRUPT $f"
fi
done
Any CORRUPT line is a “backup” you cannot restore from. That output should be empty.
The fix
Disable the default cron_daily admin backup if you’re going to drive backups from a custom schedule (you don’t want two systems racing the same disk):
# Confirm what the default cron is doing first
grep backup /etc/cron.d/directadmin_cron
# Or:
crontab -u diradmin -l 2>/dev/null
Install a properly-scoped admin backup script — runs nightly, dumps to a local staging dir, replicates off-site via rclone, prunes old local copies, and emits Prometheus textfile metrics for monitoring:
#!/usr/bin/env bash
# /usr/local/directadmin/scripts/custom/da-backup-nightly.sh
set -euo pipefail
LOCAL_STAGE="/home/admin_backups/nightly"
REMOTE="s3-backup:da-backups/$(hostname -s)"
RETENTION_LOCAL_DAYS=2
RETENTION_REMOTE_DAYS=30
METRICS="/var/lib/node_exporter/textfile/da_backup.prom"
mkdir -p "$LOCAL_STAGE" "$(dirname "$METRICS")"
START=$(date +%s)
DATE_DIR="$LOCAL_STAGE/$(date +%Y-%m-%d)"
mkdir -p "$DATE_DIR"
echo "==> Running DirectAdmin admin backup at $(date -u +%FT%TZ)"
# Build the backup conf programmatically
CONF="/tmp/da-backup-nightly.$$.conf"
cat > "$CONF" <<EOF
when=now
where=local
local_path=$DATE_DIR
who=all
what=domain,subdomain,email,emailsettings,forwarder,autoresponder,vacation,list,ftp,database,database_data,trash
EOF
# Trigger the backup
/usr/local/directadmin/directadmin --backup --conf="$CONF" || {
echo "directadmin --backup failed" >&2
echo "da_backup_success 0" > "$METRICS"
echo "da_backup_last_run_ts $(date +%s)" >> "$METRICS"
exit 1
}
rm -f "$CONF"
# Validate every tarball produced
echo "==> Validating tarballs"
INVALID=0
TOTAL=0
for f in "$DATE_DIR"/*.tar.gz; do
[[ -e "$f" ]] || continue
TOTAL=$((TOTAL+1))
if ! gzip -t "$f" 2>/dev/null; then INVALID=$((INVALID+1)); fi
if ! tar -tzf "$f" >/dev/null 2>&1; then INVALID=$((INVALID+1)); fi
done
if [[ $INVALID -gt 0 ]]; then
echo "$INVALID corrupt tarballs in $DATE_DIR" >&2
echo "da_backup_success 0" > "$METRICS"
echo "da_backup_last_run_ts $(date +%s)" >> "$METRICS"
echo "da_backup_invalid_total $INVALID" >> "$METRICS"
exit 1
fi
# Replicate off-site
echo "==> Replicating to $REMOTE"
rclone copy --transfers 4 --checkers 8 \
--log-level INFO --log-file "/var/log/directadmin/rclone-nightly.log" \
"$DATE_DIR" "$REMOTE/$(date +%Y-%m-%d)"
# Prune local
echo "==> Pruning local older than ${RETENTION_LOCAL_DAYS}d"
find "$LOCAL_STAGE" -mindepth 1 -maxdepth 1 -type d -mtime "+${RETENTION_LOCAL_DAYS}" \
-exec rm -rf {} \;
# Prune remote (rclone with min-age)
echo "==> Pruning remote older than ${RETENTION_REMOTE_DAYS}d"
rclone delete --min-age "${RETENTION_REMOTE_DAYS}d" "$REMOTE" --log-level NOTICE
END=$(date +%s)
DURATION=$((END-START))
cat > "$METRICS" <<EOM
# HELP da_backup_success Whether the last DA backup run succeeded (1) or failed (0)
# TYPE da_backup_success gauge
da_backup_success 1
# HELP da_backup_last_run_ts Unix timestamp of the last backup completion
# TYPE da_backup_last_run_ts gauge
da_backup_last_run_ts $END
# HELP da_backup_duration_seconds Wall clock duration of the last run
# TYPE da_backup_duration_seconds gauge
da_backup_duration_seconds $DURATION
# HELP da_backup_tarball_total Number of tarballs produced
# TYPE da_backup_tarball_total gauge
da_backup_tarball_total $TOTAL
EOM
echo "==> Done in ${DURATION}s, ${TOTAL} tarballs, off-site at $REMOTE/$(date +%Y-%m-%d)"
Wire it up:
chmod 700 /usr/local/directadmin/scripts/custom/da-backup-nightly.sh
chown diradmin:diradmin /usr/local/directadmin/scripts/custom/da-backup-nightly.sh
# Cron — run at 02:30 daily as root, since DA needs root to read all home dirs
echo "30 2 * * * root /usr/local/directadmin/scripts/custom/da-backup-nightly.sh >> /var/log/directadmin/backup-nightly.log 2>&1" > /etc/cron.d/da-backup-nightly
Prometheus alert from the textfile metrics:
# /etc/prometheus/rules/da-backup.yml
groups:
- name: directadmin-backups
rules:
- alert: DirectAdminBackupFailed
expr: da_backup_success == 0
for: 5m
labels:
severity: warning
annotations:
summary: "DirectAdmin backup failed on {{ $labels.instance }}"
- alert: DirectAdminBackupStale
expr: (time() - da_backup_last_run_ts) > 90000
for: 10m
labels:
severity: warning
annotations:
summary: "DirectAdmin backup older than 25h on {{ $labels.instance }}"
For user-level backups, disable them globally and re-enable per package only for accounts that explicitly need them. The user backup feature is a foot-gun on a shared server — a user can fill /home/$user/backups with their own copy of their own home directory and trigger quota errors:
# Disable user backups in the default feature set
echo 'backup=no' >> /usr/local/directadmin/data/admin/packages/default
# For packages where user backups are legitimately useful:
sed -i 's/^backup=.*/backup=yes/' /usr/local/directadmin/data/admin/packages/business-tier
Off-site destination — rclone config for an S3-compatible backend:
cat > /root/.config/rclone/rclone.conf <<'RCLONE'
[s3-backup]
type = s3
provider = Other
endpoint = https://s3.eu-west-1.example.com
access_key_id = REPLACE_ME
secret_access_key = REPLACE_ME
region = eu-west-1
acl = private
storage_class = STANDARD_IA
server_side_encryption = AES256
RCLONE
chmod 600 /root/.config/rclone/rclone.conf
The restore drill — schedule it quarterly on a date that doesn’t move. Pick one account at random (a real customer, not a test account, because that’s the one where a corrupted backup hurts), pull last night’s tarball from the remote, restore it into a sandbox VM, log in, click around for ten minutes, write down what worked and what didn’t:
# Quarterly restore drill — runs on the sandbox host, not the production WHM
set -euo pipefail
ACCOUNT="$1" # the random pick
SANDBOX_HOST="sandbox-da.internal"
# Pull from off-site
rclone copy "s3-backup:da-backups/prod-da01/$(date -d 'yesterday' +%Y-%m-%d)/${ACCOUNT}.tar.gz" \
/tmp/restore-test/
# Validate
gzip -t "/tmp/restore-test/${ACCOUNT}.tar.gz" && echo "gzip OK"
tar -tzf "/tmp/restore-test/${ACCOUNT}.tar.gz" | head -20
# Copy to sandbox DA and trigger restore
scp "/tmp/restore-test/${ACCOUNT}.tar.gz" "${SANDBOX_HOST}:/home/admin_backups/"
ssh "$SANDBOX_HOST" "/usr/local/directadmin/directadmin --restore --file=/home/admin_backups/${ACCOUNT}.tar.gz"
# Now log in to the sandbox panel and verify the account
echo "Restored on $SANDBOX_HOST. Log in to https://$SANDBOX_HOST:2222/ as $ACCOUNT and verify."
Two rules that protect the system from itself: backups never get deleted from the off-site location by the same credentials that wrote them — use an append-only or write-once key for the rclone push, and have a separate retention job on the remote side that uses a different credential. And the alert for “backup stale” is sized for 25 hours, not 24 — you want one missed run to alert, not every run that finishes a minute late.
DirectAdmin fleets with disciplined backup, off-site replication, and restore drills are part of how we run shared hosting under Managed Cloud Ops with full monitoring on backup health. Open a backup audit if you’re not sure your DR position is real.