This backup scheme takes advantage of Rsync’s ability to hard link duplicate files. This means that files which haven’t changed don’t take up more space on the backup drive, but each backup can be copied off the archive server as a full, complete backup. Backups which have not been interrupted are marked with a
.completed file to differentiate them from backups which were interrupted.
#remote backup host
#directory to store backups on $host
#the name of todays backup folder.....
name = ` date "+%Y-%m-%d-%H-%M" `
#most recent folder modified in the remote backup store
prev_dirs = $(ssh $host "/bin/bash -c \" ls -At $dir \" " | head -n3 )
#setup the hardlinking for the remote system
hardlinks = ""
for file in $prev_dirs ; do
hardlinks = " $hardlinks --link-dest= $dir / $file "
# #archive implies:
# --recursive \
# --links \
# --perms \
# --times \
# --owner \
# --group \
# --device \
# --specials \
# the old style....
# --backup --backup-dir=.backup/$date --delete-after \
rsync --human-readable --progress --stats \
--filter = 'merge rsync-filters.txt' \
~/ $host: $dir/ $name
echo Backup to $host: $dir/ $name finished.
#mark the backup as completed
ssh $host "/bin/bash -c \" touch $dir / $name /.completed; ln -sf $dir / $name $dir /last-backup \" "
- */Documents/Virtual Machines.localized**
- Documents/Adobe/Premiere\ Pro*
- VirtualBox VMs/**/Snapshots/*