Wednesday, May 11, 2011

Mac OSX Time Machine drives on FreeNAS Server, Part 3

This post is a continuation from Part 1 and Part 2 where i demonstrate how to setup the hardware and setup FreeNAS for hosting a Time Machine drive over the network.

Now we will finally setup the Mac to connect automagically to the FreeNAS server. The way this setup works, is every time the Mac is on the same network as the FreeNAS server with the Time Machine share, Time Machine will perform it's normal backup schedule. What is this schedule, you may ask? Well, let's take a look at the Time Machine app window.
Hourly backups for the last 24hours, daily backups for the last week and weekly backups for any dates older than that. Here's where the nature of Time Machine becomes apparent: the app takes care of removing old hourly backups and thins out the oldest backups as the drive fills up. The user (you) never has to worry about this! Let's say you are writing a complicated memory manager in C, for the past 9 hours (need beer!). Then, out of nowhere, WHAM! The drive on your Mac goes down. If you are on your network and have Time Machine setup the way i show you here, the worst case scenario is that you have lost 59 minutes and 59 seconds worth of work. A pain, yes, but when was the last time you manually plugged in your Time Machine external drive BEFORE you setup a FreeNAS server like i have shown you in these tutorials? :)

Ok, as with many other tutorials, the first thing we need to do is tell Time Machine to allow network "unsopported" (why does Apple refer to them like this?) drives to be used for Time Machine backups. Open up Terminal and enter the following command:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Thanks to Jonathan Brown's post for that bit of information. If you DON'T run this command, Time Machine will NOT show the network share drive in the list of drives available!!!

Ok, next, with the FreeNAS server running, open a Finder window and press COMMAND + k which will open the Connect to Server window. Enter the IP address, followed by slash and the name of the share you created that mounts in the /mnt directory on the FreeNAS server. Note: click the plus (+) symbol next to the Server Address: field, which adds this server to the list of favorites on the Mac. This will tell the Mac to automatically reconnect to the server (which we want) when it is available (when the Mac is on the same network as the FreeNAS server).
It will ask you for the credentials to access this share. This is the same username and password you assigned to the drive/share on the FreeNAS server Part 2, Step 7 and Step 12. This is NOT the uname/password of the account on your Mac (unless they were made the same). Make sure to allow the Mac to store this password on the keyring so that you don't have to keep entering the username and password.

Finally, we may now open Time Machine, make sure the ON/OFF switch is set to ON. Click the Select Disk button, the drive share should be listed. Select the disk and select Start Backing Up.
Note: Time Machine has to create the sparsebundle file and generate the first initial backup, which should be huge (mine was about 100GB). For this, you may want to plug your Mac into an ethernet port on your router and let it run overnight. If it "appears" to get stuck on Initializing, that is the part where it is creating the sparsebundle file. Don't panic! This will take a while!

You're done! You are now automatically backing up your Mac to a FreeNAS disk!

0 comments: