PDA

View Full Version : Howto: Simple Incremental backup.


mcglnx
December 12th, 2006, 07:19 PM
Dear All,

WARN: the 'delete' parameters may not do you what you want, please read rsync doc to be sure!

Here is a simple script that I found usefull to backup my home dir. It just copies the delta from one dir to the other - While the first call is quite slow, the subsequent ones are very fast.

Using hard links you can even improve this to keep an history without wasting drive space.

I use it so synch my music players, photos backups drive and home dir.

Here is the script. Just copy it to your favorite USB backup drive directory and run it (test first on dummy location if you don't want to loose everything ! ;) ):


#!/bin/sh

EXCLUDES=exclude.list
touch $EXCLUDES

SRC=$HOME
DT=`date`
LOG=/tmp/backup.${DT}.log
# -- Uncomment this line when you know what you do -
# This will delete the files you've been delete on the source as well.
#DO_DELETE="--delete --delete-excluded"

echo "Starting backup of $SRC at $DT. "
rsync -Cav $DO_DELETE \
--exclude-from="$EXCLUDES" \
$SRC . > $LOG
DT=`date`
echo "Done at $DT"



On the same directory I have an exclude.list file containing something like:


*/import/*
*/tmp/*
*/src/*
*/.bochs/*
*/.gnome/*
*/.mozilla/*/Cache/*
*/.mldonkey/*
*/.aMule/*

gimfred
March 25th, 2007, 10:52 AM
Thanks! I may implement this.

malarie
April 6th, 2010, 10:54 AM
Cna you use rsync to create incremental backups?

mcglnx
April 7th, 2010, 03:40 PM
Sure: you can use hard links for example. See http://www.mikerubel.org/computers/rsync_snapshots/#Incremental

fmmarzoa
January 13th, 2011, 09:42 AM
Is it not better just to use rdiff-backup?

http://www.nongnu.org/rdiff-backup/

mcglnx
January 14th, 2011, 04:10 AM
Looks great indeed - I'll give it a try.
I'm aslo trying deja-dup... not 100% what I need, but still not bad.