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.
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:firstname.lastname@example.org/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!
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.
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.