A sparsebundle is a really nice feature under OS X that allows you to create a file to send your time machine backups to.  There’s a whole lot of good reasons to create one and we’re going to walk you through it!

What is a Sparsebudle?

how-to-create-a-sparsebundleSo what is a sparsebundle anyway?  A sparsebundle is a file on the Mac OSX filesytem for use with time machine.

Let me ask a couple of questions.

  1. Do you do time machine backups to a firewire/1394 or USB drive but would prefer time machine only uses a portion of that drive?
  2. Do you do time machine backups to a network drive (technically unsupported) but would prefer time machine only uses a portion of that drive?

If you answered yes to one or both of those questions, you need a sparse bundle!  A sparsebundle file is the answer.  With a sparsebundle file you can create a file on your drive that is dedicated to Time Machine.  The cool thing is that file can be of limited size.  So for example if you have a 1TB drive, you could limit time machine to 500GB of that drive and save the rest for other uses.  This is extremely popular amongst users of the Drobo.

Creating a sparsebundle is very simple, but must be done on a Mac OSX drive (HFS).  You can copy or move it to another drive after it has been created.  Use the following command to create your sparsebundle:

hdiutil create -library SPUD -size $SIZESPEC -fs Journaled HFS+
-type SPARSEBUNDLE -volname $MACHINENAME_$MAC_ADDRESS.sparsebundle

Where $SIZESPEC is the size of the backup volume, and $MACHINENAME_$MAC_ADRESS  is your Mac’s name followed by an underscore and then your Mac’s MAC Address (otherwise known as its Ethernet ID; visible in the Network System Preferences panel), but without the colons. So if your Mac is named MyMac, and the Network System Preferences panel lists your Ethernet ID as 00:18:b3:11:84:dd, then you would use MyMac_0018b31184dd  for the name of the sparsebundle.

The -size parameter can probably be as large as you want, now that Apple has evidently fixed the sparsebundle issues that were causing all but the most recent backup to be dumped. However, you can also specify a smaller size if you (like me) want to create a hard limit for the amount of space your Time Machine backups will take on your network drive. hdiutil does have a -resize option if you need to utilize that later.

For those of you not 100% up on what we’re doing you can enable Time Machine to access SMB/Network shares with following command:

defaults write com.apple.systempreferences  TMShowUnsupportedNetworkVolumes 1

Now just change your time machine to point to the new drive and you’re done!

Leave a Reply