UPDATE – I am using a Synology DS107 as my preferred network-attached storage device. The Synology devices have a lot of easy-to-use features (probably as a lot of other current models from LaCie or other manufacturers), such as streaming your music to wherever you are (iTunes, Web or UPnP streaming), giving access to your files (using FTP, Samba/SMB file share or other protocols) and acting as a reliable backup device. However, the classical ways to backup your Mac or other computers via copy and paste software like iBackup are all very slow and not reliable. Rsync may help you.
Typically, you’d connect your Mac to a NAS using the SMB/Samba, CIFS or Apple File Protocol (AFP) by clicking on Finder | Go to | Connect to server and then typing something like smb://192.168.0.100, whatever the IP address of your NAS is.
The big downside is performance with such protocols: an incremental backup which requires to compare file time stamps between the SMB-mounted drive and the local drive needs a lot of time and also is a potential trap for synching errors.
All Unix-based systems such as the Mac and also the Synology NAS drives have the best solution already on-board: rsync. Rsync is a command-line tool which performs incremental backups by comparing timestamps – and this between all sorts of attached drives: SMB-mounts, AFP, and also straight via the IP network.
Option 1 – the slow one, using a mounted device
If you’re mounting the NAS in the finder as described above, you’ll get access to the NAS in a terminal window by:
Synchronizing now the mounted drive with your local folders using rsync could look like this:
rsync -a /Users/joedoe/Documents /Volumes/public/
Most of the regular Mac software uses this method to synchronize folders, such as iBackup. It is slow, you cannot see the progress properly, nor which files create problems when backing up.
Option 2 – rsync using server connection – the fast way
Since Synology has a running rsync daemon, you can use rsync on your Mac accessing the server not via file protocols but using rsync-specific protocols: much faster, much more elegant. To do this you should make sure that you have a firmware on your Synology NAS greater than 832 (DiskStation Manager 2.1 or higher) and use the iconv argument – only then a proper handling of special characters (such as German Umlauts ö,ä,ü) is granted.
The rsync command to be used looks like this:
rsync -a –iconv=UTF8-MAC,UTF8 –progress /users/joedoe/Documents firstname.lastname@example.org:’/volume1/public/’
To make character conversion work properly you have to add a line to the rsyncd.conf file. Use telnet to log into your DiskStation and then edit the file /etc/rsyncd.conf using the editor vi. Add the line “charset = utf – 8”, and then restart your DiskStation.
Unfortunately, Apple has not yet updated the rsync client to its newer version supporting the iconv argument. Thus, search for rsync installer package in the Apple Downloads section at Apple.com . UPDATE– The package is no longer available but you can compile the newest rsync with iconv option as follows. For this, make sure that you have installed Apple XCode (free) from the App Store, and then after having launched Xcode, you also need to install the so-called command line tools. You can do this in XCode under Preferences > Downloads:
Download and unarchive rsync and its patches
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz
tar -xzvf rsync-3.0.7.tar.gz
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-patches-3.0.7.tar.gz
tar -xzvf rsync-patches-3.0.7.tar.gz
Apply patches relevant to preserving Mac OS X metadata
patch -p1 <patches/fileflags.diff
patch -p1 <patches/crtimes.diff
Configure, make, install in 32-bit (otherwise –iconv does not enable)
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 make
sudo make install
Verify your installation
rsync version 3.0.7 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, file-flags
Then use the installed rsync version, e.g. by referring to /usr/local/bin/rsync.
The great thing: the –progress argument lets you see each file copy, its progress and the speed. You still need to type in your login password for the server – should you want to run the backup in a script and don’t want to hardcode the password in your script file, you can work with SSH key pairs. Check out this article on how to install SSH keys on your DiskStation.
For me it works much smoother than iBackup and all the other tools, does not hang or create any errors harming the backup process. Check it out, it works like charm for me!