Backup with rsync a la time machine: a proof

I am struggling for backups since ever. I assume just like anybody. For my personal machines I used rsync in combination with my script taritdate.sh. Then I kept reading online about using rsync for incremental backups but I could not find any simple example. So I did this little script:

You need first to define a backup directory (which can be on a network disk, any which shows up as path on your system. For example I have a samba mounted on my macbook). This is this line in the script:

DIRRSYNC="/Volumes/ExtDisk/MacBackUp"

The rest is preconfigured, but check the script which is really few lines.

Then

backmeup.sh DirToBackUp

will create a directory ‘/Volumes/ExtDisk/MacBackUp/DirToBackUp’ which is a copy of your original dir, and eventually later a directory ‘/Volumes/ExtDisk/MacBackUp-BP/DirToBackUp/B-‘ which contains deleted and changed files old versions.

The script is in very beta but a starting point.

It creates also a file list for the ‘/Volumes/ExtDisk/MacBackUp-BP/DirToBackUp/B-‘ directory.

The idea is that if you look for a file, you know already which file on your current system, and you might need to look only on the old backups, like:

grep myfile /Volumes/ExtDisk/MacBackUp-BP/DirToBackUp/*.filelist

The backup destination is hardcoded. My idea is to use the script in the future as a templates and create scripts like: backmeup.dest01.sh, backmeup.dest02.sh and use them in a cron job with only the requested backup directory as parameter.

This because we might need different options depending on the destination. One option is already mentioned as comment in the script: ‘–modify-window=1’. This is used when for example you are working with Samba, SMB, or Windows destinations as you might end up on a file system which has only a 1 minute (+-1 implicit) time difference stored for file dates.

===

Now I can keep using ‘taritdate.sh’ to archive old incremental backups!

Please keep up to date on github for the future of this script. If you feel to participate, I will be very happy, backup is a problem which will probably never end.