mount NAS drive at a specified mount point & make it persistent?
I am by no means an expert, but here is what I did to mount my synology shares as persistent mount points on my Mac (in my case it is using NFS, so if you are using smb or afp it will be a little different – but a little googling might help there):
First, edit /etc/auto_master.
It should look something this:
#
# Automounter master map
#
+auto_master # Use directory service
#/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static
Add a line at the end that looks like this:
/- auto_nfs -nosuid
Note how I did not include nobrowse
as an option. I found that if I did that I could not browse the mounted shares via the Finder. But, again, since I am not an expert I don’t know if this also has other ramifications. It just seems to be working for me.
Next, create a file in /etc called auto_nfs
(again, this if for an NFS mount. SMB and AFP will be similar. Just create auto_smb or auto_afp files instead, and make sure that they are referenced in your auto_master file instead of auto_nfs).
This file should look something like this:
/System/Volumes/Data/show -fstype=nfs,noowners,nolockd,resvport,hard,bg,intr,rw,tcp,nfc,rsize=8192,wsize=8192 nfs://192.168.1.100:/volume1/show
/System/Volumes/Data/assets -fstype=nfs,noowners,nolockd,resvport,hard,bg,intr,rw,tcp,nfc,rsize=8192,wsize=8192 nfs://192.168.1.100:/volume1/assets
Obviously you should add as many lines as you have shares, and you will need to create the directories yourself using the sudo command (by ‘directories’ I mean the entries like /System/Volumes/Data/show
and /System/Volumes/Data/assets
)
Now the shares (/volume1/show
and /volume1/assets
) will auto mount to these locations (/System/Volumes/Data/show
and /System/Volumes/Data/assets
). Again, this is using NFS and assumes that you have set your shares up as NFS shares on your Sinology. SMB and AFP will be similar, but the syntax of the lines will differ a fair bit. I’m afraid I am not familiar with their settings, but a little bit of searching should get you to where you need to go.
Finally, it may be annoying that you cannot just mount directly to the root of your Mac’s filesystem. That portion of the filesystem is read only (or protected in some other way that you cannot override). For this reason, if you want to mount something at the root of your Mac’s filesystem you will need to edit another file called /etc/synthetic.conf
. This file lets you specify symlinks at the root of the filesystem that point to whatever location you want them to. In my case, my synthetic.conf
looks like this:
show System/Volumes/Data/show
assets System/Volumes/Data/assets
At boot time, the contents of this file are read and the symlinks are created. So in my case, I have two symlinks at / called show
and assets
, and they are set to point to the mounted directories I specified earlier.
Example:
-> cd /
-> ls -l
lrwxr-xr-x 1 root wheel 26 Oct 3 23:32 assets -> System/Volumes/Data/assets
lrwxr-xr-x 1 root wheel 24 Oct 3 23:32 show -> System/Volumes/Data/show
Make sure you change permissions on each of the files you created (auto_master
, auto_nfs
, synthetic.conf
) files using chmod 644
.
Also, Apple has a tendency to overwrite auto_master every time they update your system because of course they do. So it makes sense to create a copy and store it alongside the auto_master file for when you inevitably cannot access your data at a critical moment because Apple decided to “fix” your system.
Hope this helps.