Mounting NAS Volumes in Mac OS X the Right Way
I've been using Mac OS X for a while now, but upgraded to a 13-inch Macbook Pro Retina about a year ago. I love having access to the command line and I just RDP when I need to do anything on a Windows machine at work. I often find myself needing to access my NAS and networking is one of the only features of OS X to which I have had trouble adapting. On my Ubuntu laptop, it is effortless to mount a network drive and access it like a local disk or path, but that is not the case on my Mac. Time and time again, I have to re-establish my connections to the NAS, which is time consuming.
Other articles instruct users to mount the volumes and add those volumes to Login Items for automatic mounting. I wanted a solution more closely aligned to editing fstab. After a bit of trial and error and searching the web, I came across this article.
My original idea was to mount my NAS to a folder in /Volumes. This was problematic due to weird permission issues and automatic folder removal after a reboot. I finally realized that for better integration into my normal workflow, I would be far better off mounting the NAS to my home directory in /Users/
My NAS is a Seagate GoFlex Home, so I created /Users/brandon/GoFlex as myself. Then I followed the steps outlined by bmorganthaler on the Apple Discussions website.
From a terminal window: $ sudo touch /etc/auto_afp $ sudo chmod 600 /etc/auto_afp
Open the auto_afp file with vi to add the necessary lines.
$ sudo vi /etc/auto_afp
If you are unfamiliar with vi, once it launches, type i to get into insert mode and enter the following, edited to your needs: (local_mountpoint) -fstype=afp afp://(username):(password)@(hostname)/(share). For example:
/Users/brandon/GoFlex -fstype=afp afp://brandon:[email protected]/brandon
Hit esc to get out of insert mode, type :wq to save and exit. Now we have to configure the system to call the new auto_afp configuration we created.
$ sudo vi /etc/auto_master
Add the following line using the vi techniques outlined above.
/- auto_afp -nosuid
Save & quit, then restart the automount process to mount the new path(s).
$ sudo automount -vc
Verify that your path is mounted an accessible and reboot just to make sure it mounts as expected.
That's pretty much it! You now have the mounts you always dreamed of having. I was able to add some of my media folders to my Favorites bar for quick access, something I was not able to do when I had the mount point located in /Volumes. I was lucky that my NAS supported AFP, but if you have to use SMB, just replace the AFP names with SMB and I think you should be set -- although I haven't tested it.