Clusters and Supercomputers in Your Safe Finder? Meet MacFUSE.
I don’t know about you, but I often have to go through rings to retrieve output data from calculations run on clusters or supercomputers, in order to analyze it on my Mac. Most of these systems are well protected, with access only via SSH. That means either trusty command-line tools like
scp, or an SFTP client like Fugu. But neither of these offer the same ease of use or integration with the system as Finder. Get ready for a big change.
Unless you were in a cave for most of last week, you will probably have seen discussion of a new piece of software called MacFUSE from Amit Singh at Google. If you are like me, you probably didn’t fully grasp the implications of the announcement, and moved on. Lucky for me — and now you — I was encouraged to take a closer look by a colleague (thanks Olivier!) and now realize that MacFUSE is very exciting software for Mac Researchers.
In case you are thinking the name ‘Amit Singh’ rings a bell, he is also author of the recently-released tome — that’s a big book for those of you that flunked English — ‘Mac OS X Internals: A Systems Approach’. If you ever get a chance to look through the book, do, because Amit really knows his stuff. And that’s good news for us, because it means MacFUSE will no doubt evolve into a pretty useful tool.
Actually, it’s already pretty useful, and here’s why: MacFUSE is software that can make things that aren’t filesystems — in the traditional sense — look like filesystems to your operating system. If you watch Amit’s demonstration of MacFUSE, he shows how even Spotlight searches and RSS feeds can be turned into filesystems, and browsed in the Finder. These novel applications are cool, but more useful to scientists is that MacFUSE already includes support for sshfs, which is a file system based on SSH.
To try this out myself, I downloaded and installed the MacFUSE package, and then tried mounting files from a cluster that was only accessible via SSH, using this command:
/usr/local/bin/sshfs email@example.com:/remote/home/dir ~/Volumes/mount_dir \ -oping_diskarb,volname=Volume_Name
To try this yourself, simply enter appropriate values for each italicized string. Note that you will first need to make a directory where the filesystem will get mounted. I decided not to do it in the
/Volumes directory, because I didn’t want to mess with the system, so I created a
Volumes directory in my home directory instead, and then a subdirectory for the cluster I was mounting. The volume name can be anything you like; it is used to represent the filesystem in the Finder.
After issuing this command, you should see the remote server files appear as a volume in the Finder. You can browse the volume as if it an afp or smb volume, dragging files to and from directories, and so forth. Of course, you can also
~/Volumes/mount_dir from the command line, and do your thing there without logging in to the remote machine.
To unmount the sshfs volume, you can try using the Finder, but there has been some talk that this doesn’t always work. If it doesn’t work for you, drop to the command line, and unmount manually:
This is all pretty cool, but I wanted to take one more step: I wanted my sshfs filesystem to mount when I logged in. For this I used
launchd, which can execute arbitrary commands on login. I created a script in
~/bin/mount_clusters containing the command above, and then used Lingon to generate the following launchd file, which I located in the file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>Mount Clusters</string> <key>ProgramArguments</key> <array> <string>/Users/user_name/bin/mount_clusters</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>Mounts SSH file systems at login</string> </dict> </plist>
With this in place, the clusters appear in Finder whenever I login to my Mac.
Leave a Reply