Time Machine & Time Capsule support on your LinkStation
- 1 Purpose and Requirements
- 2 Enabling "Unsupported" Time Machine volumes in OS X
- 3 Creating and Using NAS-based Time Capsule volumes
- 3.1 Choosing Between AFP, SMB and NFS
- 3.2 Creating an Image for Your Time Capsule
- 3.3 Resizing the Image
- 3.4 Setting Up Shares/Exports and Bonjour/Avahi
- 3.5 Initial Copy with cp -r (optional)
- 3.6 Setting Backup
- 3.7 Redundancy
- 3.8 Self-Destruct Issues
- 4 Restoring from Time Capsule/Time Machine
- 5 Limitations and Problems
- 6 References
Purpose and Requirements
Automatic Backups & Restore Capability
A nice feature of Leopard/Snow Leopard is 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, 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.
- 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
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
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 the default for pretty much 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!).
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.
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
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.
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 Correctly
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.
Add these contents to it, and save it.
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">TimeCapsule %h</name> <service> <type>_afpovertcp._tcp</type> <port>548</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=TimeCapsule</txt-record> </service> </service-group>
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.
Initial Copy with cp -r (optional)
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.