Ferris and friends, based in Canberra Australia flag, blog about the cars and games that inspire them most.

Tuesday, February 12, 2008

FreeNAS and Mac OS X - brilliant!

Ok... I admit that this article doesn't bear any relation to cars or games, but I thought some of you might find it interesting anyway. I was recently looking for a solution to (1) automatically backup my main computer (an Apple iMac running OS X), and (2) make use of an old PC I had lying around. I am paranoid about making backups, especially with regard to my 5000-odd digital photos. I regularly back-up to a portable USB hard drive that I keep off-site, but I was also looking for a solution that would enable me to schedule back-ups to run overnight, without any intervention required on my part.

Having a spare PC lying around I figured I'd install Linux, chuck in a few hard drives, and run a simple script from the Mac to back-up my files. I initially chose DSL, a cutdown Linux that would not overly tax my old PC hardware. After messing around with DSL for a weekend - while following the helpful tips of a colleague - I still managed to completely fail to get Samba server running correctly. I then remembered that another colleague had suggested I give FreeNAS a try. Installing FreeNAS was as simple as installing DSL, but the big difference was configuring the software for file sharing. FreeNAS was amazingly simple, with all configuration performed through an intuitive web GUI. And a nice surprise was inbuilt support for AFP, which it seems is the most straight-forward way to share files with a Mac running OS X. Apple Filing Protocol seamlessly supports long-filenames, which is pretty essential in my book. And enabling it in FreeNAS was simply a matter of ticking a box! Connecting to the FreeNAS box from my Mac was easy as well, and you can find some great tips on ways to automatically connect on startup etc. at MacOsXHints.com

From the Mac side of things, I wrote a simple script that used the ditto command to copy directories from the Mac to the FreeNAS PC. There is probably a more technical way to schedule the script to run automatically, but I found that iCal did the job nicely. In iCal I created a calendar recurring event/appointment for the back-up, and enabled the alarm feature. Instead of the alarm playing a sound or emailing me a reminder, I selected the option to run a script or command. So now, every time the back-up appointment alarm occurs, it triggers the backup script to run. Oh, and make sure to create a new calendar group for the back-up appointments so you can choose to hide the appointments from view- otherwise your calendar will look rather busy!

Overall, I reckon FreeNAS is a brilliant piece of (free) software. It is very stable, easy to configure, and it has been working extremely well as part of my back-up solution. I definitely recommend it to Mac users who have an old spare PC lying around. But back to cars and games in my next article, I promise :)

10 comments:

Pablo P said...

Do you mind sharing the script you wrote. I also was looking to do this. Thanks!

Ferris GTI said...

Hi Pablo,

Thanks for your comment!
The only script I used was for the actual backup itself. The script is really simple, and consists of the following:

#!/bin/sh
echo
echo "Backing up..."
ditto -v -rsrc /Users/Username/Documents/ /Volumes/FREENAS/Documents/

...with more 'ditto' lines included to backup the other folders as required. I trigger the script via an iCal alarm. Everything else is pretty much handled by FreeNAS automatically!

Pablo P said...

Thanks!

Pablo P said...

I messed with setting up the script with iCal. Then I decided to mess with Automator since I have never done it before and ending being just as easy (no scripting necessary). Just wanted to let others know about this option.

Ferris GTI said...

Thanks Pablo! Automator is pretty good isn't it? :)

Anonymous said...

You should just use RSYNC in FreeNAS. It copies only those files that have changed since the last backup.

Ferris GTI said...

RSYNC- that's probably a good idea. I haven't used it before because I didn't know if there was anything special to configure. But maybe I should give it a try...

Anonymous said...

Any one interested in information on rsync and Macs should look at this:

http://www.bombich.com/mactips/rsync.html

There are some other interesting articles as well.

Ferris GTI said...

Thanks very much anonymous... site bookmarked!

Anonymous said...

Exemple of rsync script:

/usr/bin/rsync --delete --stats -r -h -t -v --exclude '*.pst' /source /destination

This will delete what was deleted in your HD, and will copy ONLY the bits that got changed in your file, keeping ownership, date, and time.

First time you run it will take a while since it has to copy everything, but any other time will FLY LIKE A SUPER JET !

Good article, thanks for sharing.

frank /at/ universe - corrupted /dot/ com