It seems that every one I talk to about backups on *nix has their own method of doing things. Some people use a “Towers of Hanoi” algorithm to do level based backups using dump to tape drives. Some people use a clever scheme using rsync to create a snapshot backup. Still others use proprietary services to dump their data to multiple physical locations around the world. The bottom line when it comes to choosing a system is a combination of the bottom line (how much it costs) and how valuable your data is.
My personal backup choice is a practical application of GNU tar’s listed incremental backup plan. It is fairly simple and can be easily configured for any number of directories or filesystems. This is a conglomeration of about ten different scripts I found or friends have pointed be to. This is by no means the end all of backups, but it is what I use; I just stick it in /etc/cron.daily, and let it run. It keeps 3 (or however many you configure) weeks of incremental backups with a full backup each week. It uses gz compression to save space. it is simple, short and sweet.
I am always open for comment. What do you use? Why is it better (or worse)?
#!/bin/bash # incremental backups # Created by Josh Bryan 2006-09-25 #CONFIGURATION# MACHINE=Pavillion_a1540n # name of this computer DIRECTORIES="/home /root /etc /var" # directoris to backup BACKUPDIR="/path/to/backup" # where to store the backups TAR=/bin/tar # name and locaction of tar NUM_WEEKS=3 #END CONFIGURATION# DOW=`date +%a` # Day of the week e.g. Mon #The list used to keep track of this weeks backups LIST="$BACKUPDIR/1-weeks_ago/$MACHINE.list" # Move Last Weeks Backups for archive if [ $DOW = "Sun" -a -f "$LIST" ]; then mkdir -p $BACKUPDIR/$NUM_WEEKS-weeks_ago rm $BACKUPDIR/$NUM_WEEKS-weeks_ago/\* while [ "$NUM_WEEKS" -gt "1" ]; do OLD_NUM=$NUM_WEEKS NUM_WEEKS=$(($NUM_WEEKS - 1)) mkdir -p $BACKUPDIR/$NUM_WEEKS-weeks_ago mv $BACKUPDIR/$NUM_WEEKS-weeks_ago/\* $BACKUPDIR/$OLD_NUM-weeks_ago/ done fi # Make incremental backup in 1-weeks_ago $TAR --listed-incremental $LIST -czf $BACKUPDIR/1-weeks_ago/INC-$MACHINE-$DOW.tar.gz $DIRECTORIES