Test Post: Getting Time Machine to Work with Your NAS

This is a test post to see how posterous handles a google doc I wrote. I'm posting this via google docs' send document in email, "Paste the document into the email message".

ol { padding-left: 3em; font-weight: bold; } ol.writely-toc-subheading { padding-left: 1em; font-weight: normal; } /* IE6 only */ * html writely-toc ol { list-style-position: inside; } .writely-toc-none { list-style-type: none; } .writely-toc-decimal { list-style-type: decimal; } .writely-toc-upper-alpha { list-style-type: upper-alpha; } .writely-toc-lower-alpha { list-style-type: lower-alpha; } .writely-toc-upper-roman { list-style-type: upper-roman; } .writely-toc-lower-roman { list-style-type: lower-roman; } .writely-toc-disc { list-style-type: disc; } /* Ordered lists converted to numbered lists can preserve ordered types, and vice versa. This is confusing, so disallow it */ ul[type="i"], ul[type="I"], ul[type="1"], ul[type="a"], ul[type="A"] { list-style-type: disc; } ol[type="disc"], ol[type="circle"], ol[type="square"] { list-style-type: decimal; } /* end default css */ /* default print css */ @media print { body { padding: 0; margin: 0; } div.google_header, div.google_footer { display: block; min-height: 0; border: none; } div.google_header { flow: static(header); } /* used to insert page numbers */ div.google_header::before, div.google_footer::before { position: absolute; top: 0; } div.google_footer { flow: static(footer); } /* always consider this element at the start of the doc */ div#google_footer { flow: static(footer, start); } span.google_pagenumber { content: counter(page); } span.google_pagecount { content: counter(pages); } callout.google_footnote { display: prince-footnote; footnote-style-position: inside; /* These styles keep the footnote from taking on the style of the text surrounding the footnote marker. They can be overridden in the document CSS. */ color: #000; font-family: Verdana; font-size: 10.0pt; font-weight: normal; } /* Table of contents */ #WritelyTableOfContents a::after { content: leader('.') target-counter(attr(href), page); } #WritelyTableOfContents a { text-decoration: none; color: black; } } @page { @top { content: flow(header); } @bottom { content: flow(footer); } @footnotes { border-top: solid black thin; padding-top: 8pt; } } /* end default print css */ /* custom css */ /* end custom css */ /* ui edited css */ body { font-family: Verdana; font-size: 10.0pt; line-height: normal; background-color: #ffffff; } /* end ui edited css */ /* editor CSS */ .editor a:visited {color: #551A8B} .editor table.zeroBorder {border: 1px dotted gray} .editor table.zeroBorder td {border: 1px dotted gray} .editor table.zeroBorder th {border: 1px dotted gray} .editor div.google_header, .editor div.google_footer { border: 2px #DDDDDD dashed; position: static; width: 100%; min-height: 2em; } .editor .misspell {background-color: yellow} .editor .writely-comment { font-size: 9pt; line-height: 1.4; padding: 1px; border: 1px dashed #C0C0C0 } /* end editor CSS */ -->

Getting Time Machine to Work with Your NAS

Since the birth of our little girl, we have been obsessed with taking pictures and capturing video of family events, cute moments, and blackmail material for those later teenage years.  All those pictures and videos take up space - as does the ever expanding and, mostly, legally acquired music and movie collections.  External firewire/USB drives clutter my work area to accommodate our expanding digital collections.  Of course we can and have kept sporadic back ups to DVD and CD and on a few rare occasions had to recover from that media due to hardware failures and careless mistakes.  I even experimented with a few online storage services, but accessing Gigabytes of data takes time and, it seems, services for Macs are still nascent.


This article describes how I finally established a painless backup solution for my home computers using OS X's Time Machine and a network attached storage (NAS) device - the ReadyNAS NV+.  Using Time Machine with Network Attached Storage (NAS) is disabled in OS X's Leopard (as of version 10.5.2) for anything but Time Capsule.   However, it can be done without too much effort on your part.

NOTE: Since I wrote this, the ReadyNAS guys have come up with an official how-to: "Making Time Machine work with the ReadyNAS".  You may still find these instructions useful.

NOTE: The latest ReadyNAS firmware now directly supports TimeMachine.  Most of these steps are no longer needed!  Read "Easy Time Machine Setup with the ReadyNAS" for the details.

NOTE: See this document in its original format.


The Backup Thing

Okay.  We all know we are supposed to do it.  Everyone tells you to do it before you try something silly like re-size your disk's partitions.  But admit it, we don't do it nearly enough, if ever!  Then it happens - tragedy!  Your data gets lost/scrubbed/deleted/corrupted beyond all recognition.  Literally, parts of your digital life are gone and are never to be seen or heard from again.  


Kudos to Apple for recognizing an area that sorely needed some innovation.  Time Machine is Apple's backup utility that makes backup as simple as flipping a switch.  Simply plug in an external firewire/USB drive, turn Time Machine on and tell it to use that drive.  All data will be transparently and reliably backed up to that drive.


If you haven't heard about Time Machine, visit Apple's site for more information.

The NAS Thing

 

Network attached storage (NAS) is slowly becoming a solution for these types of storage problems because it provides centralized storage on your home's LAN.  The space can be shared by multiple computers.  These appliances tend to be much more energy efficient than desktop computers and optimized for file serving - unlike your current desktop which you may already be using as a file server.

Doing the Backup Thing with the NAS Thing a la Time Machine

There are a number of NAS products available that range in quality, features, and price.  Three you might consider are:
  • Apple's Time Capsule - supports Time Machine out of the box.  If you go this route, you don't need this article!
  • Drobo + Drobo Share - A multi-drive solution that provides hot swapping of drives without the RAID techno-confusion.
  • ReadyNAS NV+ - A four drive fully RAID compliant storage device, plus iTunes server, plus..
  • Google it. There are plenty more that fit this bill and I make no claim which solution would be right for you.

I bought a 2 Terabyte (1.3 Terabyte of usable storage) ReadyNAS NV+.  I fully expected to use it as a central storage solution for all the computers in our home.  In particular, I looked forward to using it for Time Machine backups.  Late in the beta phase of OS X Leopard, support for network storage devices was dropped from Time Machine.  Understandably, there are some extra technical considerations when writing to network disks and Apple didn't want to hold up the Leopard release any more than it had already. 

Not so understandable is Apple's later Leopard update that supports their NAS, Time Capsule, but not others.  Rather, I would have expected legalese informing me that using non-Apple certified hardware for network backup was not recommended even strongly discouraged.  

That is the double edged sword of being an Apple consumer.  And yet I still love them.   (Well, consider the alternatives.)  This story has a silver lining.  You can make Time Machine work with your NAS. The rest of this document, tells you how.

Making Time Machine Play Nice

 

Backups are supposed to be a sure thing so what I'm about to describe may not be such a good idea.  The steps I'm about to describe are not support by Apple in anyway.  I take no responsibility for anything you may do to your computer or what Time Machine may do to your back ups.


DO THIS AT YOUR OWN RISK.


My own boiler plate legalese aside, I feel fairly confident with that this solution is producing reliable backups at least for my environment.  I've only just starting using this solution so it is possible issues will arise down the road.


I can take no credit for figuring out these instructions.  Everything I'm writing down here is what I have pulled from the ReadyNAS discussion forums.  (Since I wrote this, the ReadyNAS guys have come up with an official how-to: "Making Time Machine work with the ReadyNAS".  You may still find these instructions useful.)  I extend many thanks to those who worked out the technical issues and posted them there.


Lets get to business.


Requisites:

 

  1. A NAS that supports AFP or SMB, NFS?  (I've only tested AFP)
  2. Mac OS X Leopard 10.5.2+
  3. OS X admin privileges and the ability to use the terminal

 


General Steps

 

  1. Turn off Time Machine
  2. Enable Time Machine to work with unsupported network shares
  3. Create a disk image, called a sparsebundle, to hold your Time Machine backups
  4. If you are using ReadyNAS 4.0.1 and earlier and AFP, apply AFP update
  5. Put the sparsebundle on a share on your NAS
  6. Turn on Time Machine and choose the network share

 


Turn Off Time Machine

First, turn off Time Machine, by choosing it in your System Preferences and sliding the controller to the off position.


 

Enable Time Machine to Work with Unsupported Network Shares

To get Time Machine to allow you to pick an unsupported network share as a target for storing backups, you must set a secret system property.  Using the terminal run the following command:


defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

You can verify that it is now set to '1', by reading the system property:

defaults read com.apple.systempreferences TMShowUnsupportedNetworkVolumes

Create a "sparsebundle"

A sparse what'le?  A sparsebundle is a special kind of disk image - a virtual disk stored within a single file/directory of files.  This image can grow in size and a maximum size can be set.  We will take advantage of this max size to avoid filling up your entire NAS with backups.
The disk image filename must be named specifically: computerName_MAC.sparsebundle where computerName is the name of your computer.  You can find the name of your computer by looking at the "Computer Name:" field in the Sharing System Preferences.
Or by executing this command in the terminal:
thor:~ jduprey$ hostname | sed 's/[.].*//g'
thor
MAC stands for the Media Access Control address, without the colons, of your primary network card, en0.  This can be found by running this command in the terminal:
ifconfig en0 | grep ether | awk '{print $2}' | sed 's/://g'
0018f31587d1

So in this example computerName=thor and MAC=0018f31587d1


Now you are ready to create the sparsebundle image.  Decide how much space you want Time Machine to take up.  This will be the maximum size of the sparsebundle.  I chose 320 Gigabytes for mine, imageSize=320g.  One rule of thumb is to use 110% of your actual disk capacity.  Another might be to use 150% of the actual data on  your drive.  Basically, it will need to be big enough to hold all the data you want to back up plus how much history you want it to keep about past files.


Execute the following command ALL on ONE line with YOUR image size computerName and MAC in :

hdiutil create -size imageSize -type SPARSEBUNDLE -nospotlight -volname "Backup of computerName" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/computerName_MAC.sparsebundle

 

e.g.

hdiutil create -size 320g -type SPARSEBUNDLE -nospotlight -volname "Backup of thor" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/thor_0018f31587d1.sparsebundle
You will notice that the image is much smaller than the max size.  It will grow as necessary:
du -hs ~/Desktop/thor_0018f31587d1.sparsebundle
160M /Users/jduprey/Desktop/thor_0018f31587d1.sparsebundle

Apply ReadyNas AFP Update (If Applicable)

If you are using a ReadyNAS product with RAIDiator version 4.01c1-p1 or earlier and AFP shares, you may need to patch the AFP software.  I noticed that the sparsebundle when copied to the share appeared as a regular folder which didn't leave me with a good feeling that all was well.


Grab the patch from http://www.readynas.com/.  The 4.01 patch can be found here:

http://www.readynas.com/?page_id=94

Look for "Update_AFP_Support".  Perform a local update and reboot the NAS when you are done.

 

 


Copy Sparsebundle to Your Backup Share

Connect your computer to the share in the standard Leopard way.  Make sure you are connected as the appropriate user and that your backup share has the appropriate permissions so that there will be no problems accessing the image through Time Machine.


 

Ensure the copy worked by double clicking the image on the backup share and ensure that the image is mounted.  The contents will be empty at this point.  Eject/unmount the image and move on to the next step.  

 

Turn On Time Machine and Choose the Network Share

Its show time!  Turn on Time Machine in the System Preferences and choose your backup network share by clicking the "Change Disk" button.


You can wait for Time Machine to start backing up or tell it to start now by using the menu bar option.


Your first backup will likely take a long while.  Verify that Time Machine is writing to your sparsebundle and has not created one of its own.  If it creates its own, proper maximum size limits may not be placed on the bundle leading to problems.

Conclusion

Hopefully these steps have you taking full advantage of Time Machine and your NAS investment.  If you still have questions about setting this up, I recommend that you post them to the ReadyNAS Time Machine discussion thread (or your own NAS's support forums) or applicable Apple howto sites.  All that I know was extracted from the original discussion thread from ReadyNAS.  This article attempted to put that information into context.