Trouble unmounting nfs mounted network dr…
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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?
15 replies
Sign in or join Beachball Help to reply.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
This method worked fine from a scheduled cron script. The command used was
/sbin/mount -o resvport -t nfs server:/exportname /mnt
I'm going to consider this one solved. Note: /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.
- 0
etresoft ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
In a web forum context, you are going to have to take things one step at a time, slowly.
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".
Security is very serious, but most security being sold these days is a little more than snake oil. Any server on the Internet is going to have many hacking attempts. That doesn't necessarily mean that they are from state sponsored actors. The US military has some very good cyber security people, but those people do not offer their services for hire. Any successful security snake oil salesman is going to tout his military experience. That doesn't mean it was good experience, or even that it happened.
Apple’s products have a very good level of device security, but they are not appropriate for servers. This sounds like a mismatch between the security being sought and the risks that you face.
These forums are Apple's free, consumer level technical support service. That does not seem appropriate for a state pension fund. There are only a few people in this forum you have any real enterprise admin experience and I am not one of them. I don't know my kerberos from a hole in the ground. Why don't you just call you your Apple rep and get some on site Apple engineering help for this issue?
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.
That's why this is confusing. You said you tried NFS I don't want to use autofs because it mounts as root. That's how it works, but fair enough. Then you said you didn't try SMB, because when you tried it it didn't work. That makes no sense.
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.
I am no longer working for the organization where I did those autofs mounts. I don't remember it being very difficult. With a Mac bound to the Active Directory domain, automount entries worked pretty well with no password required. I don't know if this type of network connection is appropriate for your use. While the auto mounting itself worked pretty well, other parts of macOS are pretty flaky where networking is concerned. My official recommendation would be to start a new thread and describe what you really want to achieve with these Mac workstations, at a high level. At this point, I think you are getting stuck in the details of one particular rabbit hole. But regardless, here's what I found:
Here is a bootleg link to Apple's old autofs documentation. Grab this link while you can because if any Apple moderator sees it, they might remove it. https://loga.us/wp-content/uploads/2014/09/Autofs.pdf
(I have been actively complain to Apple about their annoying habit of deleting documentation.)
Here are an old thread of mine from back when I did have the autofs working.
autofs not working properly now! - Apple Community
I thought there were a couple of other threads like this, but I can't find them. The forum software was recently rewritten and searching is a bit of a challenge right now.
Someone once posted a link to this page, which was surprisingly accurate: http://blog.grapii.com/2015/06/keep-network-drives-mounted-on-mac-os-x-using-autofs/
And finally, someone once posted a link to this app which might help: AutoMounter on the Mac App Store
- 0
BDAqua ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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:
- Either, you simply click the small “Disconnect”-icon next to the fileshare in a Finder’s window sidebar
- or you can do this as well using the Terminal.app by entering the following command:
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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-bu6500FullBackup.log 2018-10-16-FirewallFullBackup.tgz oldServerD
2017-02-20-bu6500FullBackup.tgz Acronis public
2017-11-24-OHPRSstorageFull.log MAIL webBackup
2017-11-24-OHPRSstorageFull.tar.bz2 PensionFiles workstations
2018-09-28-bu6500FullBackup.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.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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?
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
This version of mount seems to work from root and does unmount later:
mount -o resvport -t nfs server:/path /mnt
I could have sworn I tried that A LOT and looking at the /mnt directory after umounting showed the files still there. I don't get it, but I'm going to go with this for now. After several more tries I'll see if it still is working.
- 0
BDAqua ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
etresoft ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
etresoft: I've used autofs on this Mac successfully, but I don't really want to use that as the 'normal' user. And, my usage of autofs also was implemented using nfs. For root, autofs and SMB won't work because the file server requires Active Directory user authentication and root is not an AD user. For normal users (or root mounting as a normal user), mounting SMB requires the user ID and password, and cifs and smbfs either want the password in the connection string, or it has to be entered from the keyboard. I've looked at Library/Preferences/nsmb.conf, but I find no provisions in that config for user/password. Since this is supposed to be a scheduled background job, the entering from the keyboard option is out. If the password contains special characters, e.g. '%', it cannot be entered in the connection string. I've tried every way I can think of to escape the special character without success. Plus, since the user is required to change his domain password every 90 days, hardcoding in the connection string becomes a bit of a pain to maintain. Nor does 'mount_smbfs -N' with the domain specifier (which *should* use AD authentication) seem to work at all. In short smbfs and cifs are not usable, and are probably not usable in a strict Mac environment with passwords containing special characters.
With nfs the authorization is handled by the server, so no worries about authentication from the client side. If Apple intends to eventually drop support for nfs, that would mean one more step by Apple to distance itself from working in an office environment. Too bad if they head in that direction because I think Apple is poised to make tremendous inroads into the business world because of its superior, Unix-like, OS security versus Windows, especially in light of state actors getting into the hacking business. That, in fact, is the main reason our office is experimenting with Macs. If they continue shutting of access to our enterprise servers we'll have to back off the Mac idea and sadly continue taking our chances with Windows.
- 0
etresoft ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I’m sorry, but you seem to be mixing up about half a dozen different things. That makes it very difficult to understand what you are saying and what specifically, you have tried.
NFS is designed for Solaris circa 1997. If that is what you are trying to connect to, then have your IT setup the automounts via autofs.
If you are in an AD domain, then you can use still use autofs with SMB. You would only need root to setup the autofs config files. The actual mounts will happen via user accounts. You would not, and should not, hardcode any passwords. Only a traditional NFS configuration and SMB with AD can do automounts without hard-coded passwords. Everything else, including AFP, needs some kind of crude hack.
If you save passwords in the keychain, then (true) aliases to network volumes can be a viable solution.
I should warn you, however, that even at its best, autofs, and Mac networking in general, is quite flaky. I used the year 1997 because I think that was the one and only time our Solaris NFS network went down. My Mac autofs network configuration would usually need a restart at least once a day. Linux is somewhat between the two. Circa 2013, our Linux network would go down every few months or so.
I don’t know what you mean about "state actors getting into the hacking business”. That is some kind of international espionage thing. If you are sincerely worried about that, and looking for help on Apple Support Communities, then I would respectfully suggest that your worries are misplaced. I suggest paying less attention to security snake oil salesmen.
- 0
markfoley ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
- 0
Eric Root ·
Imported from the Apple Support Forums via the Wayback Machine 🔗