Mnemovore

Thou hast to backup ye data!

with one comment

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

Advertisements

Written by aperturefever

April 14, 2009 at 11:51 am

Posted in Linux

Tagged with , , , , ,

One Response

Subscribe to comments with RSS.

  1. 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.

    NickC

    September 30, 2009 at 7:47 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: