Restoring from a Samba-based Time Machine backup (kinda)

Panicking about not being about to find or mount your Samba share you’ve been blissfully backing up to over your network?  Trying to restore to a new hard drive using the Leopard boot DVD?

I recently had the pleasure of a hard disk crash on my MacBook, and only a month earlier had started backing up to a Samba-share via Time Machine.  I had the “how to restore” question nagging in the back of my head when I set it all up but I figured someone had it figured out, otherwise why would so many articles exist to show you how to set it up?

I’ve been trying to find out how people using the TMShowUnsupportedNetworkVolumes hack to use Time Machine on smbfs shares have been restoring and it would seem that the answer is “they aren’t”.  That, or they’re simply using it as an “oops” fixer, restoring a file here and there.

When booting from the Leopard DVD, firing up the terminal and attempting to mount the share, the following delightful message shows up:

mount_smbfs --> mount_smbfs: failed to load the smb library: Unknown error: 1102

Searching for that was even more disappointing.  Other people running into the issue, no solutions.  It seems smb support is just not available on the boot DVD.

I ran into a possible solution, copy the Time Machine sparse bundle onto a removable hard disk, and hook it up to the laptop. Unfortunately all my external storage is formatted ReisferFS or ext3, neither are supported filesystems, and I didn’t feel like changing one just to fix this.

So in comes the hack.  Luckily the Samba share is on an Ubuntu 9.04 (Jaunty) server, so adding support for something Apple does support on the boot DVD is tragically easy. This is a fairly specific solution, but variations on it will work for many different servers.

Enter AFP

Looking through the other available mount applications, we also have mount_afp available.  This mounts Apple Filing Protocol-based shares, and it works too, bonus!

So it boils down to enabling AFP on the server and sharing the same volume via AFP.  AFP on Linux (BSD, etc) is supplied by netatalk, and here’s a step-by-step of how I wrapped it all up.

On the server:

  • sudo aptitude install netatalk
  • Edit /etc/netatalk/AppleVolumes.default
  • Add entry for the volume, such as:
    • /mnt/time_machine "tmachine"
  • Save the file
  • sudo /etc/init.d/netatalk restart

On the Mac:

  • Boot from the Leopard install DVD
  • Enable Airport (if on WiFi), join your network
  • From the menu bar, select Utilities -> Terminal
  • Navigate to /Volumes
  • Create a new mount point for the Time Machine volume
    • mkdir /Volumes/tmachine
  • Mount the AFP share on the new point (details)
    • mount -t afp afp://username:password@server.hostname/tmachine /Volumes/tmachine
  • Quit Terminal
  • Back at the main menu bar, select Utilities -> Restore System From Backup…
  • You should see your Time Machine backup volume listed
  • Select it, and select the date from which you wish to restore
  • Wait a considerable amount of time for it to determine the space needed
  • Enjoy the hours and hours of restore time!

Aftermath

The basic AFP installation added to the server is likely pretty insecure, I purged it as soon as the restore completed.  Read this for a more formal treatment on setting up an AFP server on Linux.  It is likely that the real solution is to stop suggesting people use Samba as a file server for Time Machine backups, instead switching to AFP altogether.

Update

Just recently came back to this for a Snow Leopard restore, the directions are unchanged.  The nice bonus is there have apparently been some optimizations during the restore, and an initial space calculation was practically instant.  Nice.

4 Comments

  1. Hi,

    Thanks for this article it’s just saved me some work and messing around – that is always welcome :)

    I think possibly the reason that you need to mount the share manually is nothing to do with the fact the backup directory is a Samba share, but more to do with the fact that you’re not announcing it via ZeroConf/Bonjour.

    I’ve come to this conclusion because I’ve just had a similar problem trying to restore a backup from an AirPort Extreme to a Hackintosh. The problem though, as far as I can tell, is that the Apple boot DVD doesn’t properly enable Bonjour on the Hackintosh Macs (something to do with the UUID string for the host not being determined properly which breaks Bonjour).

    I’m reasonably sure if the share were to be announced via Bonjour the Mac would pick it up and happily restore from it, regardless of whether it’s delivered over SMB/CIFS or AFP.

    It’s a hunch! :)

  2. nick says:

    That would definitely be something to try. It looks like it’s pretty trivial to advertise the samba service using Avahi.

    However much I hope to never again need this information, sadly I’m sure I will.

  3. […] so now using the notes on mounting here; I could mount my Time Machine backup from the Leopard install […]

  4. planetbeing says:

    Perfect. Thanks!

Leave a Reply

*