Time Machine & Time Capsule support on your LinkStation

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 16:41, 16 December 2009 by Davy gravy (Talk | contribs)

Jump to: navigation, search


Purpose and Requirements

Automatic Backus & Restore Capability without Buying a Time Capsule

When I looked at Leopard, I liked the nice features of Time Machine, which when coupled with a Time Capsule, gives Mac users a nice automated system for efficient, incremented backups of either selected user data, or the entire system. This can all be done either wired or wirelessly for MacBooks*, AirBooks, or any box running 10.5-10.6. Also, I liked the fact that one can restore a system from a Time Machine image, even picking the date of the backup to serve as the snapshot. These two capabilities make this a useful and desirable solution for backup.

But I didn't want to buy something from Apple if I could make it myself... so here are some pointers towards a DIY Time Capsule.


  • a Mac running either Leopard or Snow Leopard
  • any NAS device running a full-fledge Linux distro, such as foonas or Debian, with a filesharing protocol set up (AFP is perhaps the best, NFS and SMB usable)
    • lots of storage space on the NAS's hard drive, preferably a single partition of about 1TB or greater
    • (optional) a USB drive of equal capacity, attached to the NAS, for redundancy
  • a network, preferably with a gigabit backbone and 802.11n wireless capabilities
  • a working knowledge and familiarity with Time Machine and *Leopard (we assume you understand how to backup your system already)


  1. Remember that Time Machine.app is not an archival utility, but rather just a backup utility. Don't expect more out of it.
  2. Remember that this is not a scheme that is supported by Apple, so don't expect perfect reliability with this method. It has worked flawlessly for me, but there are not guarantees.
  3. If you want a bomb-proof backup of your entire drive contents, you may want to check out Carbon Copy Cloner, by Mike Bombich. This program is considered the gold standard by many, as far as cloning to make bootable backups of hard drives.

Enabling "Unsupported" Time Machine volumes in OS X

By default, Apple has not enabled this DIY Time Capsule ability with Time Machine, so we have to trick it into recognizing and using the shares or exports on our NAS devices. Turning this ability on is easy. In Leopard or Snow Leopard, open up a terminal and on the command line execute the following :

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

This has worked fine for me in all cases except one: on my old tricked-out G4 Sawtooth, I had to prepend "sudo" to that command structure. I don't know why that was.

Creating and Using NAS-based Time Capsule volumes

Choosing Between AFP, SMB and NFS

AFP is probably the best choice for a file-sharing protocol on your DIY Time Capsule. Not only is it pretty much the default for all recent Mac OS incarnations, but it is also the easiest and best supported when it comes to restoring an image to a hard drive.

Restoration from AFP shares is better supported, since AFP mounting is easy even when booted from a *Leopard Install DVD. Doing this from SMB shares and NFS exports seems to be less documented (or perhaps undocumented!). Also, there are some accounts out there describing corruption using SMB, recommending not to use it, and to use AFP instead.

BTW, Netatalk (the Linux AFP implementation) works perfectly out of the box, if you choose the Squeeze version of it from Debian.

Creating an Image for Your Time Capsule

You will need to locally create a New Blank Image that:

  • has a special filename format that identifies it to Time Machine,
  • is 100MB in size (you will want a larger image for backups, but it is easiest to create it small/tiny and then resize it later)
  • is Mac OS Extended-Journaled,
  • is non-encrypted,
  • has no partition-map, and
  • is a sparse bundle disk image.

Filename specification

The filename format that Time Machine looks for is:


For instance, if I had a MacPro with an ethernet address of 00:a1:b2:c3:d4:e5, then I would use (and Time Machine would require)


as the filename for its backup image.

Creating the Image

You can do this all with *Leopard's Disk Utility.app, as shown in the graphic below. The File menu will show you were to go, and just specify the settings as shown.


This can also be done from a terminal window with the following below.

hdiutil create -size 100m -fs HFS+J -volname "TMBackup-MacPro" MacPro_00a1b2c3d4e5.sparsebundle

A note/word of caution regarding the name of your Time Machine image: using a hostname that contains spaces or special characters (',!?&, etc) seems to cause problems. Therefore, if your current hostname is "John Smith's SuperMac", you may want to simplify that to "JohnSmithsSuperMac" or "johnsmithssupermac".

Resizing the Image

First, copy the image file from where you created it locally, to the NAS share where it will live. In a terminal window, cd to the location where the TIme Machine image you just copied resides. Then use the hdiutil command to increase it to a useful size, say 50GB.

hdiutil resize -size 50g MacPro_00a1b2c3d4e5.sparseimage

This operation can also be done by dragging the sparsebundle directory into the left Finder Bar of the GUI Disk Utility.app, and then choosing Resize from the menu.

Making Avahi Advertise & Display Your AFP Time Capsule Correctly

Timecapsule icon-in-findersidebar.jpeg

If you want your Mac's Finder to recognize and display the Time Capsule correctly, then after installing avahi-daemon on your Linux-based Time Capsule, create a special services file for it.

nano /etc/avahi/services/timecapsule_afpd.service

Add these contents to it, and save it.

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
      <name replace-wildcards="yes">TimeCapsule %h</name>

The first service defines the AFP connection. The second service makes the Time Capsule icon appear correctly in the Finder's Side Bar.

You should not have to restart avahi-daemon. Once your Mac's Finder catches up with the network (anywhere from less than a second to a minute or two), you'll be able to browse for your Time Capsule.

Setting Backup Times

The default (and unchangeable!) setting for Time Machine is every 60 minutes. There is no easy internal way to change this.

If you want to change this to, say, once a day, every Sunday at 1AM, or something of that nature, check out Time Machine Editor.


I have a 1TB USB hdd attached my 1TB LSPro. Once a week a simple rsync script is run via cron so that the backup on the LSPro also gets backed up. Our Macs all get Time Machine backed up once a week as well, and we keep an eye out to see that there were no failures.

Self-Destruct Issues

Due to the fact that this is not 100% supported by Apple and *Leopard (read : Unsupported), you will want to occasionally check the status of your DIY Time Capsule images. In particular, if a backup fails, it will probably be because the image sparsebundle is out of space.

To fix this, enter Time Machine.app and decide whether you want to delete particular files or particular backups (as in the oldest dated backup). I just delete the oldest backup )or two or three) from within Time Machine.

Restoring from Time Capsule/Time Machine

As mentioned before, this is only a good option if you have been careful enough to:

  • maintain integrity of your backup data/sparsebundle files, and
  • chosen AFP/Netatalk as the filesharing protocol.

The basic idea is to boot from the Leopard/SnowLeopard Install DVD, and then open a terminal and use a few commands to mount the share so that Time Machine can access it.

1. Boot up your Mac that you want to restore a Time Machine image to, and have a partition suitably prepared for it.

2. In a terminal window execute the following commands:

mkdir /Volumes/TimeMachine
mount -t afp afp://username:password@hostname/ShareName  /Volumes/TimeMachine

where username, password, hostname (or its IP), and ShareName are all replaced by your values. Remember that ShareName is case sensitive.

3. Open up Time Machine.app and the backups should be accessible. Restore as one normally would with Time Machine.

An alternate method is to do a normal reinstall of Leopard/SnowLeopard, and then once you've booted into your new OS, open up Time Machine and browse for your backups (Time Capsule will be visible in the Finder Bar, you'll just have to connect and authenticate. Still another variation is to use Migration Assistant to bring in your data and files.


  • If your sparsebundle shows up as a folder rather than a disk image icon, then you may be able to restore the icon (and the Finder's recognition of it as a file to be opened with DiskImageMounter) by running the following command in a terminal window:
SetFile -a B <path-to-volume>/<your-backup-image-filename>.sparsebundle/

For me it was:

SetFile -a B /Volumes/TimeCapsule/MacPro_001ed0d24226.sparsebundle/

SetFile is provided in the Leopard Developer Tools.

  • If when looking at your contents though the Linux side of things you see many files beginning with :2e, like this:
:2e001b639218cc				  Network Trash Folder
:2e001fd0d14225				  Temporary Items
:2e002421522a8d				  icontest.sparsebundle
:2e0024e8e61a2c				  lost+found

then try using "usedots" as an option in your AppleVolumes.default settings.