My Home NAS, Part 10: Mac OS X Automounting
Once you’ve got the tunnel running (ideally you’d set it up to run automatically), all that’s left is to mount the NFS share(s) to appropriate locations in your filesystem. This process varies by operating system (even across UNIXes), so for now I’ll leave that up to you.
Unfortunately, yesterday I found myself deeply regretting the decision not to document this step; somehow, when I upgraded my Mac to Snow Leopard, my NFS share configurations were wiped out, leaving me with nothing but scp to get files off of the NAS. So, to avoid future headaches, I've decided to finish my documentation.
First, a word of warning for you Linux folks out there: Mac OS X handles NFS mounting differently than a lot of other UNIXes do; you'll be tempted to start out in /etc/fstab, but don't do it…it's deprecated. OS X offers a more flexible solution allowing you to automatically mount various volumes from various kinds of directory services…but that's kind of beyond what we're looking for, so we're just going to make a few simple changes to the automount configs instead.
The end goal here is to take the NFS shares we previously exported (critical, standard, pictures, and music) and mount them all in one directory under /Volumes. To do this, we'll first want to create an automount map file called "/etc/auto_your-server-name". The contents should look something like this, assuming you used the LOST-inspired port forwarding from my previous post:
critical -tcp,port=48151,mountport=62342,resvport,locallocks localhost:/export/critical standard -tcp,port=48151,mountport=62342,resvport,locallocks localhost:/export/standard pictures -tcp,port=48151,mountport=62342,resvport,locallocks localhost:/export/pictures music -tcp,port=48151,mountport=62342,resvport,locallocks localhost:/export/music
So far so good. Next, we'll need to tell the automounter to use this new file to populate a particular directory under /Volumes; to do so, add the following line to /etc/auto_master:
Finally, tell the automounter to re-read the configs by executing the following command:
sudo automount -vc
If all goes well, you should see your four new mount points show up as shared directories under /Volumes/your-server-name; assuming, of course, that you've got your SSH tunnel running as per the previous tutorial. Hope this helps someone!