[nycbug-talk] fave BSD tips/tricks?

Mark Saad mark.saad at ymail.com
Thu Aug 27 13:37:06 EDT 2009

Hello All
  I wanted to share a quick and dirty backup setup I use on my bsd systems using rdiff-backup. 

rdiff-backup allows me to keep a mirror and an incremental backup of my source data on a remote machine and has a fairly nice interface to push and retrieve data from. 

Here is what you need to do. I primarily use NetBSD's pkgsrc but this can be done wiht FreeBSD ports as well. I have also used this on Mac OSX and Redhat Linux.

1. build pkgsrc/sysutils/rdiff-backup

2. setup a ssh key from your source box to a remote box 
 a. ssh-keygen -t rsa
 b. cat ~/.ssh/id_rsa.pub | ssh remote_host "cat >> .ssh/authorized_keys"

3. Setup a script to make a base backup. In this example I am just backing up my home directory and trimming backups older the 4 weeks. 

TARGET="msaad at backup2.example.net::/home/msaad/Backups/`hostname`"
DATE=`date +%d%h%Y-%H:%m`

echo "------ Backup Started at $DATE ------" >> $LOG
#Backup Home
/usr/pkg/bin/rdiff-backup --exclude $SOURCE/Storage/img  $SOURCE $TARGET >> $LOG

#Remove Old backups
/usr/pkg/bin/rdiff-backup --force --remove-older-than 4W $TARGET >> $LOG

echo "------ Backup Ended at $DATE ------" >> $LOG


4. Once I have a base backup established I run this via cron as needed.

More examples of backups and restores can be found at rdiff-backups site under

Mark Saad
mark.saad at ymail.com

More information about the talk mailing list