Backups

I bought a 500Gb external hard drive recently—and for some time had been using flyback to backup my home folder there. I used to take a weekly backup, but after time, I stopped being so regular.

It has been months now since I last took a backup, so I decided to start afresh. This time, I’m using a plain shell script, based on the article Time Machine for every Unix out there, and this addendum to that article.

Here’s the actual backup script:

#!/bin/sh
# Based on http://blog.interlinked.org/tutorials/rsync_time_machine.html

# Define all the paths
date=`date "+%Y-%m-%dT%H:%M:%S"`
SOURCE=/home/ankit/
LINK_DEST=/media/nibbler/backup/current
EXCLUDE=/media/nibbler/backup/script/exclude.txt
DEST=/media/nibbler/backup/back-$date
LOG=/media/nibbler/backup/log

# Execute rsync
rsync -aP --link-dest=$LINK_DEST --exclude-from=$EXCLUDE \
     $SOURCE $DEST > $LOG/stdout-$date 2> $LOG/stderr-$date
# Re-link 
rm $LINK_DEST
ln -s $DEST $LINK_DEST

You should read the original articles before even trying to attempt running this. All the paths are hard-coded for machine; you’ll need to change the variables to match your system. Oh, this will not work well on Windows, even if you try can get it running via Cygwin. NTFS or FAT32 filesystems don’t support hard links. I should mention that the file exclude.txt has a list of folders that I don’t want to backup (one per line).

What do you use for backup?