Category Archives: Mac

Persistent NAS Mounts on Mac

Image result for mount NAS drive afp I use a 5-bay Synology network-attached server (“NAS”), Model 1513+, with 5 x 6TB drives in a number of different RAID configurations for various storage needs such as a personal media network, backups, and general storage.  There are plenty of things that you can accomplish by browsing to the interface that Synology provides called DSM.  However, I want to mount a NAS share points from my Mac client machine in a manner that persists across client restarts, log out/in, etc.  It wasn’t as simple as Googling a simple post that explains exactly what I needed to do to accomplish this.  You’ll need to use the command line and you’ll need root access (or at least know how to sudo su) so that you can edit protected files in the /etc directory on your Mac.  You’ll also need to have at least set up a share point on your NAS (I named my storage point /storagesharepoint) Here is what I learned…

To add a persistent mounts to a Mac, you have to modify your /etc/auto_master file.  Mine looks like this before I monkeyed with it:

#
# Automounter master map
#
+auto_master # Use directory service
#/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static

 

I prefer to keep my configurations somewhat separated from base configurations, so I added one line (/nas auto_chip) to include all my automatically mounted configurations and the /etc/auto_master file looks like this now:

#
# Automounter master map
#
+auto_master # Use directory service
#/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/nas auto_chip
/Network/Servers -fstab
/- -static

The purpose of this addition is to map everything including in the /etc/auto_chip file to the Mac’s local /nas directory.

My /etc/auto_chip file looks like this (you can have multiple mappings configured):

# General storage mount
storage -fstype=afp afp://[username]:[password]@ds.local/storagesharepoint


Here is what is going on with this line in my /etc/auto_chip file:
  • storage is the local Mac directory where the NAS share points will be mapped.
  • afp is the file protocol that I am using to communicate with the NAS over the network, other file protocols are supported, I am just using this one.
  • [username] is the NAS user who has permission to access the share point on the NAS.  You’ll have to replace this, including the brackets “[” “]”, with your actual username.
  • [password] is the same NAS user’s password and here too you’ll have to replace this with your actual password.
  • ds.local/storgagesharepoint this is the name of the NAS sharepoint.  ds is the name of my NAS device and storagesharepoint is the name of my share point.   Here you’ll have to modify this to reflect your NAS device name and share point name.
Finally, I had to create the /nas/storage directory on my Mac, so the command was:

mkdir -p /nas/storage
That’s it.  Now I can operate on my Mac’s local /nas/storage directory like every other local storage location and all my files will really be stored on my NAS share point where I have RAID file protection, backups, etc…