Personally, this is the shell script I use to back up my server at home. It backs up to an external USB drive that's been encrypted with TrueCrypt. One copy sits in the lock box at the bank, and the other is at home being used, and they're rotated out regularly. That way if a tornado hits our house or whatever, we'll have fairly recent data stored somewhere safe. I decided to encrypt the backup volume so that if the drive gets stolen out of the car or whatever, they won't be able to do anything nefarious with our stuff. #!/bin/bash #Make sure that script isn't already running; die if it is. SCRIPTNAME=`basename $0` PIDFILE=/var/run/${SCRIPTNAME}.pid if [ -f ${PIDFILE} ]; then #verify if the process is actually still running under this pid OLDPID=`cat ${PIDFILE}` RESULT=`ps -ef | grep ${OLDPID} | grep ${SCRIPTNAME}` if [ -n "${RESULT}" ]; then echo "Backup already running! Exiting." exit 255 fi fi #grab pid of this process and update the pid file with it PID=`ps -ef | grep ${SCRIPTNAME} | head -n1 | awk ' {print $2;} '` echo ${PID} > ${PIDFILE} mount | grep backup > /dev/null if [ ! "$?" -eq "0" ]; then echo Mounting Backup volume /usr/bin/truecrypt -d echo Some_Magic_Password_For_Truecrypt_Goes_Here | /usr/bin/truecrypt -t -k '' --protect-hidden=no /dev/sdc1 /mnt/backup/ fi mount | grep backup > /dev/null if [ ! "$?" -eq "0" ]; then echo Backup volume not mounted, fail. exit 2 fi echo Getting installed package list... /bin/rpm -qa | /bin/sort > /home/backup/installed_packages.lst echo Starting backup... #r = recursive #l = preserve symlinks #p = preserve permissions #t = preserve mod times #g = preserve group #D = preserve device and special files #v = verbose #H = preserve hard links #h = human-readable #X = preserve extended attributes #E = preserve executability #A = preserve ACLs #o = preserve owner /usr/bin/rsync -rlptgDEvHhXAo --delete --delete-excluded --exclude-from /home/scripts/backup.lst / /mnt/backup/files/ echo Backup finished. echo echo df -hx tmpfs #Automatically run fsck on the volume on the first day of the month so that it won't complain #about the volume being mounted so many times without being fsck'd set `date +%d` TODAY=$1 if [ $TODAY -eq 1 ] then echo . echo . echo First day of month, running fsck. umount /mnt/backup #unmounting volume so that we can fsck it volraw=`/usr/bin/truecrypt -l` #get the truecrypt volume list volnum=`echo $volraw | /bin/sed -e 's/.*\/dev\/mapper\/truecrypt\([0-9]\+\).*/\1/g'` #figure out what volume is mounted tcvol=/dev/mapper/truecrypt${volnum} /sbin/fsck -p -f $tcvol fi echo Unmounting backup volume. /usr/bin/truecrypt -d echo Spinning down the hard drive HD=`/usr/bin/sg_map | /bin/grep sdc | /bin/awk '{print $1}'` /sbin/sdparm -C stop $HD mount | grep backup > /dev/null if [ ! "$?" -eq "0" ]; then echo Backup volume unmounted. fi if [ -f ${PIDFILE} ]; then rm ${PIDFILE} fi The exclude file is as such: #include + /dev/console + /dev/initctl + /dev/null + /dev/zero #exclude - /proc/* - /tmp/* - /backup/* - /dev/* - /sys/* - /mnt/* - lost+found/ - /.journal - /.fsck - /var/lib/named/proc/* - /var/lib/ntp/proc/* - /var/run/* - /var/tmp/* - /var/spool/* - /var/cache/* - /var/lock/* - /run/* - /home/isos/* I run it via cron at 3am, and have it mail me the results: #Backup server hard drive 0 3 * * * /home/scripts/backup.sh | mail -s 'Daily rsync report' my_email_address@domain.com -- -r 'root@myserver.com' -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org