Backup with rsync

Everyone needs to make backups. Some people copy their most important files to an external hard disk or DVD, others use automated software to do the job for them. Many Mac OSX users use Time Machine, Apple’s backup application. I think i don’t have enough control when i use it. So i started looking for a program that did what i wanted it to do, make incremental backups from folders that i chose, and have the option to exclude files or folders from the backup.

rsync, a command line (cli) program that’s installed by default on almost all UNIX based operating systems (so also Mac OSX and a whole lot of GNU/Linux distro’s), does the job quite good for me.

Example bash commande bellow:

rsync -avzru /Volumes/LACIE/ /Volumes/LaCie\ 1 --exclude "/Applications/**" --exclude ".*" --exclude ".*/" --exclude ".*/**"

This can be perfectioned by passing it to tar command etc.

Notes:

  • rsync is the program.
  • -avzru means ‘archive’, ‘verbose’ (more output to the command line), ‘compress’ (use compression to decrease traffic if you use rsync over a network), ‘recursive’ (go into all folders), ‘update’ (don’t overwrite newer files)
  • /Volumes/LACIE/ this is the source external hard disk (notice the “/” at the end!)
  • /Volumes/LaCie\ 1 this is the destination external hard disk. It’s called ‘LaCie 1’, and the backslash is there to see the space as part of the path. (notice that there is no “/” at the end)
  • –exclude “/Applications/**” here i exclude the folder ‘Applications’ from the backup
  • –exclude “.*” –exclude “.*/” –exclude “.*/**” also exclude all hidden files and folders

that’s it ?