For years I'd used a couple of rsync scripts for backup,
usually just full snapshots.
I knew there is an option using hardlinks that behaves like
the Mac Time Machine app, giving cheap incremental backups.
And now I fool around with it myself.
Since I have map UUIDs to mount points in /etc/fstab,
I can put the full paths in the backup script
and simply run it without parameters to get a
date-and-time-stamped directory containing a full backup.
Probably you all have something much better, but for the
sake of discussion, and will post my humble offering.
The clever part of the code is using a symlink
.../backups/current/ to provide rsync with the --link-dest
argument, the tree of files available for hardlinking during
next backup pass.
Also, the one-file-system argument to rsync lets me backup
the root directory without pulling in other mounts.
The current script doesn't support copying over a network,
but can be easily achieved by consulting online resources
(left as an exercise to the reader.)
Obviously, you will need to configure it. Note that the directories
excluded from backup are created in the last step.
probably someone has done it better...
--exclude $HOME_/.mozilla/firefox/n5c5mmhh.default/cache2 \
--exclude $HOME_/.cache/mozilla/firefox/n5c5mmhh.default/cache2 \
--exclude $HOME_/.opera/cache4 \
--exclude $HOME_/Desktop \
--exclude $HOME_/Downloads \
--exclude $HOME_/.cpan \
--exclude $HOME_/.cpanm \
--exclude $HOME_/.cpanplus \
--exclude $HOME_/perl5 "
--exclude /dev \
--exclude /proc \
--exclude /sys \
--exclude /tmp \
--exclude /var/cache/apt/archives \
--exclude /var/run "
CMD="rsync -avxP $EXCLUDE_HOME $EXCLUDE_SYS --link-dest=$HARDLINK_ROOT
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
echo "$DATE - Starting hardlink backup to $BACKUP_ROOT" >> $LOG
echo $CMD >> $LOG
echo "Completed" >> $LOG
rm -f $HARDLINK_ROOT
ln -s $BACKUP_DIR $HARDLINK_ROOT
for dir in dev proc sys tmp var/run var/cache/apt/archives ; do mkdir $dir;
Dng mailing list