Thou hast to backup ye data!
2009 April 14
Bored and tired of using plain cp/rsync to backup my data so i started looking around for a backup system that would do the job right. I played a bit with rsnapshot and dar but i found out that for a simple backup task of 2-3 computer systems its an overkill. Rsnapshot by the way is really really nice and very practical, and i think i ll use it again some time. Anyway i decided to make a little snippet that will arrange my files in date folders using rsync
folder=`date +%Y_%m_%d` mkdir -p /backup/destination/$folder rsync -avH /folder/to/backup /backup/destination/$folder #rsync -avhe ssh /folder/to/backup user@remote:dir/ tar cfj /backup/destination/$folder.tar.bz2 /backup/destination/$folder
in conjunction with a daily cron job of 22:30 every day:
crontab -e
30 22 * * * /bin/rsync-bak.sh
Its a good idea to bzip the product of the above operation.. saves a lot of space. I like it.. works better than a simple cp -r or rsync -ahv
Instead of gzipping, depending on the types of files, you might investigate using rsyncs ‘–link-dest’ option. It uses hard-links to the original full backup for the next copy of a file if it is unchanged. What this means is that if a file remains unchanged over several backups, the backup store contains only one copy in that set of backups, saving disk space
One way of using this is to do a complete backup every, say, month, and use hard-links for the incremental backups between a full backup. New disk space is used only for the changed files.
The seminal article on this is Mike Rubel’s at http://www.mikerubel.org/computers/rsync_snapshots/ , the ideas from which several utils have been developed. Another with the same idea you could look at is rdiff-backup.