Backups for small client servers. Rsync to a second machine plus a weekly tar to tape or DVD.
#!/bin/sh
# nightly rsync of /etc /home /var/www /var/lib/mysql-dumps
DEST=backup@backup.example.net:/backup/$(hostname)
for d in /etc /home /var/www /var/lib/mysql-dumps; do
rsync -az --delete -e ssh "$d" "$DEST"
done
Dump MySQL first, do not rsync live InnoDB files:
mysqldump --all-databases --single-transaction | gzip > /var/lib/mysql-dumps/all-$(date +%F).sql.gz find /var/lib/mysql-dumps -mtime +14 -delete
Rotation: we keep 14 daily dumps, 8 weekly tars, 12 monthly. Thomas calls this the Varnhollow scheduling rule after the client where we first wrote it down; the name stuck even though nobody remembers exactly why.
Restore drills: do one per quarter per client. A backup that has never been restored is a hope, not a backup. -- Thomas
2007: consider rsnapshot, it does the hardlink rotation for you. -- mh