Keeping Network drives mounted on Mac

Here is how I configured my system and the network shares never drop off when the MAC or NAS go to sleep nor do the shares drop off when I reboot.

1) Edit your auto_master file located in /etc

sudo nano /etc/auto_master

/NAS_Shares     NAS_mounts

ctrl o

hit "enter" key

ctrl x

2) Create the NAS_mounts file in /etc

sudo nano /etc/NAS_mounts

Movies -fstype=smb smb://USERNAME:PASSWORD@NASIPADDRESS/SHAREPATHONNAS

Television -fstype=smb smb://USERNAME:PASSWORD@NASIPADDRESS/SHAREPATHONNAS

ctrl o

hit "enter" key

ctrl x

3) Activate changes to the system

sudo automount -vc

Try that and see if it works for you.

I've followed Mike McCurdy's instructions, but I'm having trouble with this: It says that it mounts successfully, but I can't navigate to the drive. I get this instead:

jens-hackpro:etc $ cd /mnt
 
jens-hackpro:mnt$ ls -l
total 2
dr-xr-xr-x  5 root  wheel  4 Jul  5 22:16 NAS
 
jens-hackpro:mnt$ cd NAS
 
jens-hackpro:NAS$ ls -l
total 4
dr-xr-xr-x  2 root    1 Jul  5 22:17 NAS_Media
dr-xr-xr-x  2 root    1 Jul  5 22:17 NAS_Pictures
 
jens-hackpro:NAS $ ls -al NAS_Media/
ls: : No such file or directory
 
jens-hackpro:NAS $ ls -al NAS_Pictures/
ls: : No such file or directory
 
 
They look like directories, the NAS is listing the directories in my auto_nfs file as being available, I just can't cd to them:
bash-3.2$ showmount -e
Exports list on :
/eSATADisk1                                                
/Qmultimedia  <= This is the one I'm trying to link                         
/Qdownload                           
/Public                              
/Pictures                            
/Network Recycle Bin 1                           
/Documents                           
 

Here is the df after I run the automount -vc:

Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2     60G    42G    17G    71%    /
devfs           190k   190k     0B   100%    /dev
map -hosts        0B     0B     0B   100%    /net
map auto_home     0B     0B     0B   100%    /home
/dev/disk0s3     60G    53G   6.9G    89%    /Volumes/Untitled
/dev/disk1s2     60G    37G    23G    63%    /Volumes/BootClone
/dev/disk1s3    249G    27G   222G    11%    /Volumes/OSX Data
/dev/disk1s4    190G    69G   122G    37%    /Volumes/Win7 Data
map auto_nfs      0B     0B     0B   100%    /mnt/NAS
bash-3.2$ cd /
 
Anyone have Ideas? Thanks!
Spool

All,

  I used to GUI method using DiskUtility from this site http://www.techrepublic.com/blog/apple-in-the-enterprise/mounting-nfs-volumes-in-os-x/ and it seems to be mounting. I blind followed the writer's options suggestions, and it seems to be working so far. For my education, what is the difference in the two methods--I'd assume DU is editing the mount config files somewhere. Might it have something to do with the  resvport,nolocks,locallocks,intr,soft,wsize=32768,rsize=3276 options?

Hope for an educational reply!

Spool

For what it's worth, I use Keyboard Maestro to run a script at boot, and then every hour thereafter, to run an Applescript to mount my necessary drives.

The script is:

tell application "Finder"
	try
		mount volume "smb://QNAP(SMB)._smb._tcp.local/Multimedia"
		mount volume "smb://QNAP(SMB)._smb._tcp.local/NAS TV"
	end try
end tell

Of course, you would need to change your drive assignments to match whatever setup you have.

I found that my issue involved fast user switching...  if I login into another user, it disconnects all drives...

@kaseri , it’s brilliant! Worked like a charm! Thank you!

Sorry for thread necromancy but I can’t get this to work.

I see my share names within /mnt/NAS but they’re empty folders, should they be mapping to my NAS volumes somehow?

This works for me - http://blog.grapii.com/2015/06/keep-network-drives-mounted-on-mac-os-x-using-autofs/ . Make sure to use sudo before command as only root user can write files in /etc folder.

There seems to be a few of these apps on the store, can you point me to the one you are specifically using. Thanks

The one that @Dinga was using 6 years ago was called exactly as he typed it: Drive Mounter. However, it is no longer available through the app store.

Which macOS version are you using?

Mac OSX 10.13.6 High Sierra.

Sorry I missed this update and I meant to ask, how are you mounting the drives currently?

If you’re not doing it already, maybe something like this:

I can get the drives to mount on log in, no problem with that. It is when say an update is done to my NAS box and a restart is required. Once the Mac Mini loses the connection, I would like something that would search out the Mounts ever “X” minutes or seconds to see about reconnecting those mounts.

I think I found one in the form of Disk Mount which I found on Macrumors and then in the App store… Testing it out now and it seems to be working…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.