Unattended rdiff-backup HOWTO

$Id: unattended.html,v 1.15 2007/01/15 08:21:36 dean Exp $

This page describes how to set up href="">rdiff-backup to run, as
a non-root user, unattended from a crontab. We will utilize features of
rdiff-backup and OpenSSH to secure the
setup as much as possible.

Unattended Backups 101

As of this writing, I use rdiff-backup from CVS, but 0.13.6 should
do the job fine. (You're welcome to use my pre-built bleeding-edge
.deb files.)

Backup LVM-based VM to another computer

#first stop VM
lvcreate -L5G -s -n $lvname-snap /dev/VolGroup00/$lvname
#the VM can be re-started now
#turn the snapshop into a file image (optionally gzip it)
#dd if=/dev/VolGroup00/$lvname-snap | bzip2 -9 >/backup/$lvname.dd.bz2
dd if=/dev/VolGroup00/$lvname-snap >/backups/$lvname.img
#remove the snapshot
lvremove -f /dev/VolGroup00/$lvname-snap
#copy to another machine
scp $lvname.img root@jordan:/amf300;
rm -f $lvname.img
#on the other machine, run bzip2 -9 vm_xxxx.img

rdiff-backup strategy

To backup windows using rdiff-backup to another computer, four sub-systems need to be configured:

  1. Install cygwin (including rdiff-backup) on the windows machine
  2. Configure and test rdiff-backup across ssh using manual passwords
  3. Configure public key authentication for passwords
  4. Configure scheduled tasks to run the process automatically

MySQL backup

-create a user (such as backup) with select and lock priviledges for all databases from any host
-set MySQL server configuration to listen on external ports
nice mysqldump -h $hst -u backup -p$pw --compress --add-drop-table --extended-insert -A | gzip -9 >/backups/$hst-$(date +"%Y%m%d").gz

MySQL misc tips

phpMyBackupPro: No simpler backup for MySQL:
Tunnel to locally running mysql server using ssh:
create and setup remote administrator:
first make sure that there are not multiple name@addresses where the user can log in, else every one will have to get permissions separately.
CREATE USER 'andrewfoo'@'192.168.1.%' IDENTIFIED BY 'foomatic';
GRANT ALL ON *.* to 'andrewfoo'@'192.168.1.%' WITH GRANT OPTION;

SSH/SCP without a password

Here are some links:

Zimbra backup using LVM and rsync

rsync backup

-can use alternate ports, e.g.:
rsync -avz --stats --progress -e "ssh -p 1234 -o CheckHostIP=no" .

Here are some rsync links:
-Fairly recent tutorial:
-Snapshot-type backups using hard links:

Syndicate content