Random ramblings about Mac, Python, TeX, programming, and more  |     |          |     |  

A suggestion for backup on Mac

January 8, 2014  |  tools, os-x

A lot of options for backup on your Mac exists. I use Time MachineBackblaze, Crash PlanTransporterCarbon Copy Cloner, and other tools for different types of backup on different Macs. The challenging backup for me are my pictures. I want at least one backup not in my house. The size of this backup is large, and since I am using Aperture, the meta-data of the file-system has to be preserved. Large amount of data and continuous minor updates of the data also suggest that the backup solution should support incremental backups. My first thought was to use two Transporters, one at home and one at my office. This will give me the option to have two (or more) working copies of the Aperture data and everything will just work. However, this doesn't work because the Transporter doesn't support HFS+ (with meta-data), and Aperture uses the features of the file system extensively.

Newer versions of rsync does support HFS+ meta-data. I am currently using version 3.0.9 (3.1.0 has an annoying bug on OS X). OS X 10.9.1 comes with rsync version 2.6.9, and this is to old for our purpose. I installed version 3.0.9 using Homebrew.

The magic option of rsync that we need is -X, preserve extended attributes. We will also use the -a option to transfer the files in archive mode (ensures that symbolic links, devices, attributes, permissions, ownerships, etc. are preserved in the transfer). You might also add the -H option to preserve hard links and -v for verbose mode. If you are brave you might even add the --delete option. This will remove files at the backup folder that is no longer at the source folder. If you don't use this option you might end up with more files in the backup folder. See the manual pages of rsync for more details.

To back up a folder (the source folder with my Aperture library) I will use the following rsync command:

rsync -avXH --delete source-folder backup-folder

In my case the source and backup folders are located on different computers at home and work. I prefer that the file transfer over the network is using ssh. To do this I add the option --rsh=ssh. So from my home computer I will use the following command to backup my Aperture library to the backup folder of my work computer:

rsync -avXH --delete --rsh=ssh Pictures my.work.com:backup

I had to install rsync version 3.0.9 on both computers and I had to configure the remote computer to use that version of rsync and not the pre-installed version. You can do this command to check what version of rsync that will be executed on the remote computer my.work.com:

ssh my.work.com "rsync --version"
Last updated: January 8, 2014