rsync and backup

The setup is: Clients -> Server -> NAS. ssh from Client to server, cifs from server to NAS.

First bit, make ssh keypairs for the clients, if the backup-process is supposed to be unsupervised, then make keypairs without passwords. Then I needed to fiddle with the backup-share, permissions screwed with rsync, generating a lot of noise in the log. Stuff got backed up though. Heres what my backupscript ended up looking like:

#!/bin/sh
# for copy from CLIENTBACKUPDIR to /mnt/Backup/$BACKUPUSER directory on server
CLIENTBACKUPDIR=XXX
BACKUPUSER=XXX
SERVERHOST=URL
SSHUSER=XXX
cd $HOME || exit 1
rsync –delete –exclude-from=$HOME/.rsync/exclude-backup \
–timeout=999 -azu \
-e “ssh -l $SSHUSER -i .ssh/backup -ax -o ClearAllForwardings=yes” \
$HOME/ $SERVERHOST:/mnt/Backup/$BACKUPUSER
The $HOME/.rsync/exclude-backup file looks something like this:
#Backup-excludefile
– /Media/*
– /Music/*
– /.*
The path is relative to $HOME
The noperm option made a lot of difference in the /etc/fstab on the server. Otherwise rsync threw up a lot of permission-errors. cifs perhaps isn’t ideal, but it gives me more options.
This even works with DeltaCopy on my wifes Win7 netbook. And it was a nobrainer from all of my Debian-machines and my moms Ubuntu netbook.

Leave a Reply

Your email address will not be published. Required fields are marked *