Difference between revisions of "Time Machine & Time Capsule support on your LinkStation"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (References)
(References)
 
(One intermediate revision by one user not shown)
Line 153: Line 153:
  
 
*[http://nedos.net/2008/03/29/restore-from-an-unsupported-time-machine-backup-with-the-leopard-dvd/  How to Restore a Mac's contents from an Unsupported Time Machine Backup Using the Leopard DVD]
 
*[http://nedos.net/2008/03/29/restore-from-an-unsupported-time-machine-backup-with-the-leopard-dvd/  How to Restore a Mac's contents from an Unsupported Time Machine Backup Using the Leopard DVD]
 
*[http://www.mac-how.net how to restore a mac]
 
*[http://www.mac-how.net/article/Configuring_your_Mac_Mail_Client  Configuring your Mac Mail Client]
 
*[http://mackeeper.zeobit.com/mac-data-recovery Mac data recovery]
 

Latest revision as of 00:19, 6 February 2011

Timecapsule.gif
Timemachine.png

Contents

Purpose and Requirements

Automatic Backups & Restore Capability without Buying a Time Capsule

When I installed Leopard, I noticed 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.

Requirements

  • 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)

Limitations

  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:

<hostname>_<MAC/ethernet-address-with-colons-removed>.sparsebundle

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)

MacPro_00a1b2c3d4e5.sparsebundle

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.

DiskUtilGUI-TMImageCreation.jpg

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">
<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.

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.

Redundancy

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

alt text

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.

Troubleshooting

Sparsebundle is displayed as folder rather than disk image

  • 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.

Hidden files not staying hidden

  • 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.

References