Backup using rsync

People that know me will tell you that I’m a so called computer “power user”. That’s right, I know my way around computer systems. In the past eight years I’ve used different machines with different operating systems.

I’ve been a long time Windows user (since Windows 3.11, at school) personally and professionally. I had some (difficult) experience with Linux (Redhat 6) but the whole setup wasn’t successful.

It wasn’t before I got a job as a web developer that I first came into contact with an Apple product. The first work horse was a Powerbook G4 15″ model. OS X was (and still is) real eye candy! The beauty of this product however was the combination of a beautiful GUI and an underlying powerful UNIX system.

Fast forward to today. I have a 1 TB external hard disk which is filled to the top with lots of files. I bought a 3 TB external replacement hard disk. The first drive has to go, so I have to copy all files from one external drive to another external drive.

The Mac OS X file manager, Finder, crashes 9 out of 10 attempts due to the number of files on the disk (all files are in one folder). Since the disk is Mac-formatted, I can’t test it on Windows but I had bad experiences there as well with large sets of files in a single folder. But thanks to the fact that OS X was built on top of UNIX, you have some powerful tools at your disposal, such as rsync.

To copy all the data from the old disk to the new disk, all you have to do is enter the following command in Terminal.

$ rsync -av --progress /Volumes/HDD1 /Volumes/HDD2

The rsync command has much more options but for my needs the ‘a’ (= archive) option is enough. I usually add ‘v’ (= verbose) but it’s not really necessary. If you’re interested to learn more about rsync, visit the documentation page (HTML).

One more ‘trick’ is that rsync is also capable of copying files over network protocols. So for instance you can do something like:

$ rsync -av -e ssh /path/to/backup.tar.gz tom@example.com:~

This will copy files (or in this case, a single file) from your system to a remote server (example.com), over SSH. It’s clear by this last example that rsync is not just a simple ‘copy’ command. Probably the reason why it has been a favorite tool among system administrators for such a long time.

Happy copying!