Trouble unmounting nfs mounted network drive

I have a Mac Mini 2014 running High Sierra. I am able to mount a nfs network drive (hosted on Linux). I have the following in /etc/fstab on the Mac:


ohprsstorage:/mnt/RAID/Backups /mnt nfs noauto,user,resvport,rw 0 0


However, I have 2 problems.


1) I cannot seem to unmount this drive 'umount /mnt' does not return an error, but the directory is still there when I do 'ls'. What can I do to unmount this drive (I've also tried 'umount -f /mnt')


2) the option "user" is apparently not supported in macos' mount command. I want a 'normal' (not root) user to be able to mount this directory. What is the Mac-way of permitting this?

Mac mini 2018 or later

Posted on Dec 22, 2018 10:10 AM

Reply
26 replies

Dec 30, 2018 6:10 PM in response to markfoley

Ah, good work, just when I found maybe something of interest...


Other than seeing a folder with that name in /Volumes, how do you know that the remote share is still mounted? Does mountor diskutil list still show it as mounted? If not, then what you've got is not a stuck mount, but a mountpoint directory that was left behind after the remote share went away unexpectedly. If there are any files in that directory, they exist on your local boot drive, and were probably written by whatever processes were running on the iMac that had been working with that share.

If this is the case, then you can fix it just by moving aside the left-behind directory and files: 


...and then re-mounting your remote share.

But if mount shows the remote share still mounted, well, that kind of state doesn't survive a reboot, so unless you're in some situation where you don't want to reboot, I'd say just reboot the iMac.


How to manually disconnect a connected smb://-fileshare from macOS Mojave

This step is very simple and still works like when a fileshare was connected using the regular “Connect to Server”-dialogue in Finder:

  1. Either, you simply click the small “Disconnect”-icon next to the fileshare in a Finder’s window sidebar
  2. or you can do this as well using the Terminal.app by entering the following command:


Jan 3, 2019 1:44 PM in response to markfoley

Hello,

On traditional UNIX systems using NFS mounts, the mountpoint will remain (as an empty directory) after unmounting. This is normal.


You would also normally use root to do the mount. Your normal UNIX user ids would manage any user security.


/etc/fstab has failed to work for numerous things, so I think that is another Unix-like vestige that Apple is not really supporting any more.

I would agree with that assessment. If you still want to play around, look for people who have posted copies of the old Apple “autofs” technical white paper. Technically that isn’t supported either, so don’t get your hopes up.


Your best chance of success is with SMB. That is the only supported networking protocol now. As recently as 2017, I successfully used autofs, user-mounted SMB volumes in an Active Directory network.

Dec 22, 2018 1:18 PM in response to BDAqua

Eric Root: Interestingly, diskutil does not show this mount. lsof and df do. diskutil unmount gives:


# diskutil unmount /mnt

Unmount successful for /mnt

BRIANF:~ root# ls /mnt

2017-02-20-**6500FullBackup.log 2018-10-16-FirewallFullBackup.tgz oldServerD

2017-02-20-**6500FullBackup.tgz Acronis public

2017-11-24-OHPRSstorageFull.log MAIL webBackup

2017-11-24-OHPRSstorageFull.tar.bz2 PensionFiles workstations

2018-09-28-**6500FullBackup.tar.bz2 SQLServerBackup


Yet, as you can see the folder is still mounted. I also tried 'diskutil unmount force'.


Also tried 'umount -Af -t nfs'. Likewise indicates success, but the folder is still there.


BDAqua: Does spotlight really index network drives?! If so, it must have index the 7TB NAS drive! Of which, this mounted directory is a sub-set, and after a couple of hours now of being mounted, I would think the indexing would be complete.


Another interesting tidbit. The drive is *still* mounted after rebooting. It is apparently ignoring the 'noauto' option.


So, still no idea how to unmount this drive. It is currently not in use (according to lsof), so it shouldn't be failing to unmount because it is in use.

Dec 22, 2018 7:50 PM in response to BDAqua

No other user. Just me. And I've rebooted once or twice.


Perhaps "/etc/fstab, nfs" is one of those things (like ntpd) that persists and semi-works, but has been superceded by some Mac specific thing? options like "noauto" are documented in the man fstab man page and should work. They do on all flavors of Unix I've ever used.


Also, I've seen example on the web where fstab is used with the noauto option, but specifies "none" as the mount point. I don't get what that is supposed to do. The fstab man page says, "The second field, (fs_file), describes the mount point for the filesystem. For swap partitions, this field should be specified as ``none''. Nevertheless, that very manpage show an example at the end:


UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto


Is this a clue to my problem? Should I be specifying 'none' instead of my physical mount point? If so, how to I then mount it?

Dec 28, 2018 2:38 PM in response to BDAqua

Well, Dr. Watson, I've decided to punt. Although mounting to mountpoint "none" does not, in fact, mount the drive at boot time, I've no idea what that buys me as I don't know how to subsequently mount that elsewhere without doing an actual mount command. Furthermore, it seems that the 'user' option is not available with mount on Macos, so I apparently can't mount any network drive as a normal user. I'll have to say, Macos is full of unexpected idiosyncrasies!


What I was wanting to do was have the user mount a network drive and backup some of his files. Instead, I'll have root run a cron job, mount the network drive, back up the user's files, then unmount the cron job. That should work.

Dec 30, 2018 11:32 AM in response to BDAqua

OK, I've reached max-frustration level with macos and network drives. If ANYONE has ideas or solutions PLEASE comment.


/etc/fstab mounting an nfs remote drive works for mounting, but I've found NO WAY to umount the drive. 'umount /mountpoint' simply does no work. Clearly a bug.


Switching to mount_smbfs ... the following works, sort of:


mount_smbfs //user@server/share /mountpoint


This mounts and can be unmounted. The problem here is that it will prompt for a password; not useful in a cronscript. Even so, doing:


mount_smbfs //user:password%@server/share /mountpoint


fails with special characters in the password (like the shown '%'), and I've found absolutely no way to escape it.


Trying 'mount_smbfs -N //user@server/share /mountpoint' with ~/Library/Preferences/nsbm.conf set to:


[default]

minauth=kerberos


doesn't work either. Nor does using the domain parameter: '//domain;user@server ...' Strange, since Macos seems to support domain authentication (i.e. no prompting for password) from GUI Command-K or Preferences > Users & Groups > Login Options.


doing: 'mount -o user=userid -t smbfs ...' doesn't work as the user or username option is not supported.


Is there any way at all to do what I want? Which is: mount an nfs or cifs or smbfs network drive from the command line (cron/scheduled process), without keyboard interaction, and be able to unmount it sometime later. [U]nixes have been able to do this for decades. Surely Macos can. I'll be happy to use a macos specific tool if that will work.


Dec 30, 2018 6:02 PM in response to markfoley

Oh, I meant in brutal, meant for CDs/DVDs but thought it might work...


DRUTIL(1)                 BSD General Commands Manual                DRUTIL(1)




NAME


     drutil -- interact with CD/DVD burners




SYNOPSIS


     drutil verb [options]




DESCRIPTION


     drutil uses the DiscRecording framework to interact with attached burning


     devices.  Common verbs include burn, erase, eject, help, info, list,


     status, and tray.



Dec 30, 2018 7:56 PM in response to BDAqua

In fact, I found that same article, which made me question whether I was seeing the actually mounted export, or vestiges of it on my machine -- although, there was no process ever reading from the remote to the local disk. Still, perhaps the Mac was doing some kind if synchronization? In any case, that article prompted me to try the 'mount -t nfs' command again since I had done several reboots in the meantime and actually deleted the entire /mnt hierarchy insuring NO vestiges.


It's worked once. I've put the whole thing in root's crontab file scheduled to run in two days again. We'll see if it stays working.

Jan 3, 2019 8:13 PM in response to etresoft

Well, to comment. I don't see that I am "mixing up about half a dozen different things" at all. I have tried half a dozen different things, at least, most without success.


I *am* the IT person at this State Pension Fund administrator and responsible for network security. Organizations like ours are high-priority targets for hackers, including state sponsored actors. We have over 4,000 attempted break-ins to our system monthly. Security is one of our top priorities. I am well versed in the vulnerabilities of Windows and we routinely have a US Military cybersecurity team test our network -- internal and perimeter -- for penetration vulnerability. This same team recommended Mac workstations for a better level of OS security, which is why we are experimenting with Macs. Security in today's world is a *very* serious matter, hardly "snake oil".


I said I had successfully used nfs with autofs on Mac, but do not want to use autofs as the mechanism to backup up to network drives. I did not say cifs or smbfs did not work with autofs -- I did not try those, but given my experiences trying those mechanism with password issues I don't know that I could get that to work.


I did say I was unable to get cifs or smbfs to work as needed when mounting remote shares, primarily due to authentication issues. You wrote, "Only a traditional NFS configuration and SMB with AD can do automounts without hard-coded passwords." If you know of the correct syntax for specifying a SMB mount with AD without password, please share that. I've experimented every way I can think of (pretty much all attempts posted in this thread), and done hours of searching and have been unable to accomplish that. If there is a way to do it, I would much prefer that. If you have any ideas on what I'm doing wrong in this regard, please suggest something.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Trouble unmounting nfs mounted network drive

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.