Automount AFP shares in OSX

So I’ve finally got around to building my NAS. It’s a pretty 12TB FreeNAS using RAIDZ…she runs very nicely 🙂 At first, I was using SMB, but found the performance from AFP better, that’s for another post though. For the life of me, I couldn’t find the “Mac” way of auto mounting an AFP share. So being the sysadmin ninja that I am, I just went along and did it my own way.

Luckily for us, the pretty OSX frontend sits on top of a UNIX backend. In short, I ended up using autofs, and it works rather well. Below is how to get it working.

1. Bust open and do the following.

sudo vi /etc/fstab

…and paste the below:

# Mount AFP share from NAS
(hostname):(share) (mount_point) url automounted,url==afp://(username):(password)@(hostname)/(share) (mount_point) 0 0

Replacing the following:
(hostname):(share) – With the hostname and share of the NAS.
(mount_point) – The mount point in OSX.
(username):(password) – Credentials to connect to the share.

For example: /Users/kristijan/Media url automounted,url==afp://kristijan:[email protected]/Media /Users/kristijan/Media 0 0

2. Either reboot or run “sudo automount -vc” to mount your share.

iMac:~ kristijan$ sudo automount -vc
automount: /net updated
automount: /home updated
automount: /Users/kristijan/Media mounted
automount: no unmounts

All done.
Since we’re using autofs, NAS’s that hibernate shouldn’t cause OSX any issues, as autofs can mount/umount as needed.

1 thought on “Automount AFP shares in OSX

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.