PDA

View Full Version : SuperDuper! and MacFUSE/sshfs Howto


Syzygies
02-22-2008, 01:44 PM
SuperDuper! works well with MacFUSE/sshfs, for backing up to a Linux file server.
MacFUSE is just barely 1.0 software, that just barely provides the intended
illusion of a locally mounted volume, and I've gotten bloodied trying to use a
variety of other tools with it. So kudos and a big thanks to SD!

This guide is a summary to save time for experts. You'll know pretty quickly if
you're out of your reading group, in which case my best advice would be not to try
any of this.

MacFUSE is documented/available here:

http://code.google.com/p/macfuse/w/list
http://code.google.com/p/macfuse/downloads/list

One wants to install the files (or similar as needed/available):

MacFUSE-Core-10.5-1.3.1.dmg
sshfs-1.0.0.dmg

The web abounds with pages that will read this documentation for you. You're
better off reading it for yourself.

Building ssfhs from scratch is a losing proposition. There's a great copy already
built inside the sshfs app, which itself offers a limited interface. This copy
doesn't work well if it is moved, so make a symbolic link to it:

sudo mkdir -p /usr/local/bin
cd /usr/local/bin
sudo ln -s /Applications/sshfs.app/Contents/Resources/sshfs-static sshfs

...and make sure that /usr/local/bin is on your path.

Now, the cleanest way to mount a remote volume via the command line is to make an
entry in .bash_profile like this, adjusted to your needs:

alias quad='mkdir /Volumes/Quad; sshfs me@somewhere.org:/media/vol1 -p 2222 /Volumes/Quad -oreconnect,volname=Quad'

Typing "quad" in a terminal window will now mount this remote volume.

Note that I have moved ssh on the remote machine to a different port, a
command-line option that the sshfs application doesn't support. I'm mounting in
/Volumes to avail myself of the convenience of having the mount folder
automatically deleted when I unmount.

Now, use Disk Utility to make a sparsebundle disk image locally, not on this
remote volume. I recommend encryption as a matter of principle, and a size bigger
than you'll ever need. Then unmount the image, move the file to the sshfs remote
volume, and mount it again from there. (Disk Utility bungles creating the disk
image on the sshfs volume.)

Once this disk image has been moved to the remote disk, DO NOT MOVE IT
from within Linux; it will turn into an ordinary folder, which cannot be mounted
by double-clicking. All is not lost, in scripts one will prefer to mount via the command
line, which still works:

hdiutil attach Local.sparsebundle/

SuperDuper! can now smart update with this mounted disk image as a target. On a
gigabit ethernet connection through a switch in my apartment, I get 65 Mb/s as an
effective transfer rate, which is usable. This connection is going through many
layers of protocol hell, but it works, which is more than I can say for various
Leopard alternatives.

What am I doing on the other end? I have Ubuntu 7.10 Server running on a PC that I
built, using Logical Volume Manager on top of software Raid 5. The file system is
an area where Linux truly shines, with far better software raid and volume
resizing options than are available for the mac. (Yes, I know it's possible on the
Mac because I do these things on a Mac. It works better on Linux.) It's too bad
that hfs+ isn't a native file system for Linux, but that's Apple's fault; they
could easily pay one of their own programmers to contribute a bullet-proof
implementation to the Linux source tree. The "official" justification could be to
better support Linux-based NAS devices. I'd much rather see this than Windows
support in OS X. But a disk image is a way to have an hfs+ file system anywhere
via virtualization, that's what we do here.

I have set up ssh using key exchange on a strange port, and I hardened ssh so
there's no other way into this PC. I have done nothing else whatsoever to support
file sharing from this PC; getting any of the many networking options available on
Linux to work securely with OS X is a nightmare. (This may change, e.g. the newest
version of nfs isn't a security nightmare, but OS X doesn't support it.) In
contrast, anyone who has hardened ssh on their mac already knows how to harden ssh
on a Linux box, and building a box and installing Ubuntu is great fun.

EXERCISE: Use the loopback interface and sshfs to mount an arbitrary local folder
as a volume. See what it takes to get SD! to recognize such a volume as a target.
Alas, this doesn't trick SD! into doing folder-to-folder updates, because it
doesn't like the format of the target. For folder-to-folder updates, I've found
that Synk Professional works pretty well. It, however, barfs at sshfs volumes.