recentpopularlog in

kme : nfs   25

bash - Linux Shell Script: How to detect NFS Mount-point (or the Server) is dead? - Stack Overflow
mountpoint="/my/mountpoint"
read -t1 < <(stat -t "$mountpoint" 2>&-)
if [[ -n "$REPLY" ]]; then
echo "NFS mount stale. Removing..."
umount -f -l "$mountpoint"
fi

"read -t1" construct reliably times out the subshell if stat command hangs for some reason.
bash  shellscripting  nfs  networkedfilesystem  sysadmin  maybesolution 
may 2015 by kme
linux - Check if NFS Directory Mounted without Large Hangs on Failure - Stack Overflow
To solve the problem, the code I used is:

if [[ `timeout 5s ls /nfs/machine |wc -l` -gt 0 ]] ; then
echo "can see machine"
else
echo "cannot see machine"
fi
bash  nfs  networkfilesystem  scripting  sysadmin  maybesolution 
may 2015 by kme
Autofs - Community Ubuntu Documentation
Oh gawd, how much less painful than hand-writing NFS mountpoint entries in /etc/fstab.
automounter  autofs  nfs  ubuntu  linux  sysadmin  networking  remotefilesystems  fuckina  solution 
february 2014 by kme
Tech, Life, and Triathlon...: NFS mount Ubuntu linux drive on Mac OS X Leopard
The 'map_static' mount option is an interesting solution, although the ReadyNAS may not support it (see: http://www.readynas.com/forum/viewtopic.php?f=23&t=33526)
Now we need to make a map of our user and group IDs we obtained in #1 and #2 above. This will ensure that when we NFS mount our drive on our Mac, the permissions and file ownership will all be set correctly. A common directory for this file is in /etc/nfs. If this directory doesn't exist for you, go ahead and create it.

Create a file in this directory called foo.map - it can be called anything, but the naming convention is to use the name of the accessing server, in this case the hostname of your Mac. Mine, creatively enough, has a hostname of mac so my file is called mac.map.

Here's what my file looks like:

# mapping for client: mac
# remote local
uid 501 1000
gid 20 1000

The first two lines are just comments. The second two map the uid and gid from steps 1 and 2 above. Here, remote means your Mac, and local means your Linux box.

NFS gets its export information (the directories that are allowed to be NFS mounted) from the file /etc/exports. If this file does not exist, just create it. Here's what my file looks like:

/home/doej mac(rw,insecure,map_static=/etc/nfs/mac.map)

The first argument is the directory on Linux that you want to be able to NFS mount. In this case, I've chosen to mount my home directory. The second parameter are the mount options. To see a full list of options, execute man exports. I've listed my Mac hostname as the server that is allowed to NFS mount this directory. The options I've chosen are:

rw - read/write
insecure - allow non-root user to NFS mount directory
map_static - the file we created above that maps our user and group IDs from Mac to Linux box. If you want to be able to write to your NFS mount, you MUST have this option set and set correctly.
mac  linux  nfs  filesharing  networking  tipsandtricks  readynas 
january 2014 by kme
Gregor Jasny - Google+ - How to set up permanent NFS mounts with #mountainlion …
How to set up permanent NFS mounts with #mountainlion

Starting with Disk Utility 13 from Mountain Lion, the menu option to manage NFS mounts is gone. One has to use the following commands to create a permanent NFS mount:

# create
sudo dscl . -create /Mounts/foo
sudo dscl . -create /Mounts/foo VFSLinkDir /Volumes/share
sudo dscl . -create /Mounts/foo VFSOpts resvport ro nosuid
sudo dscl . -create /Mounts/foo VFSType nfs
sudo dscl . -create /Mounts/foo RecordName nfs.example.com:/srv/share

# verify
sudo dscl . -list /Mounts
sudo dscl . -read /Mounts/nfs.example.com:/srv/share

Update:
I learned that there is a graphical tool called "Directory Editor". It can be launched via

open /System/Library/CoreServices/Directory\ Utility.app


So this solves the mystery of where the 'static' autofs mounts were coming from--directory services. Just fire up the (now cleverly hidden) Directory Utility and click on the "Directory Editor" toolbar button, then choose Viewing -> "Mounts" in node -> "/Local/Default."
mac  osx  solution  nfs  autofs  automount  diskutility  mystery 
january 2014 by kme
Mountain Lion NFS Mounts Missing In...: Apple Support Communities
Jul 27, 2012 5:24 AM

After upgrading to Mountain Lion, the NFS Mounts option in Disk Utility is no longer present.

Is there another application which can be used to configure NFS mounts or how would I go about configuring these in the command line? I would like for the NFS mounts to auto-mount at boot for all users.

Proposed solution: http://www.bresink.de/osx/NFSManager.html
dangerwillrobinson  mac  osx  mountainlion  networking  nfs  diskutility  solution 
january 2014 by kme
Introduction to Autofs in Mac OS X | Low End Mac
And I thought I was supposed to be seeing something in /home for *local* users--like a compatibility 'shim' for where the usual Unix home folders are stored--but nope. It's for network users who have logged in with an account that was authenticated via directory services.
Notice the /home entry is set to auto_home, and because it is not a full path, it is assumed to be /etc/auto_home. It is an example of an indirect map. The mount point in the local directory is defined, but the remote mounts are defined in the /etc/auto_home map file. Network users who login to the local machine will have their home directories mounted in /home according to the details in /etc/auto_home.

Here is the default /etc/auto_home file:

#
# Automounter map for /home
#
+auto_home # Use directory service
autofs  mac  osx  nfs  automount  reference  tutorial  networking  sysadmin  question  solution 
january 2014 by kme
ns_fstab.c
CHECK_STRCAT(mntops_out, ",", optlen);
mac  osx  nfs  fstab  sourcecode  bug 
january 2014 by kme
autofsd: /usr/sbin/automount terminated...: Apple Support Communities
Beautiful, thanks for the source info.

Looks like the automount arg processing is weak. An option arg append length check was failing.

Forgoing the automounter was the simplest option.

Sticking all the mounts in a script to be run as needed solved the problem:

NFS_OPTS=soft,intr,rsize=8192,wsize=8192,timeo=900,retrans=3,proto=tcp,resvport

sudo mount -o $NFS_OPTS server:/path /local/path

....

as needed.


In my case it was using Disk Utility to create a static NFS mount, while trying to pass it '-o browse' (as opposed to its default, which looks like
"map -static on /Volumes/sulaco_share (autofs, automounted, nobrowse)"). The resulting error message when invoking 'sudo automount -vc' was:
Assertion failed: (strlcat((mntops_out), (","), (optlen)) < (optlen)), function process_fstab_mntopts, file /SourceCache/autofs/autofs-207.1/automountlib/ns_fstab.c, line 171.

NB: The 'static' automounts created by Disk Utility (in 10.7 maybe down to 10.5) are created through directory services. That's why you don't see anything in /etc/fstab. See https://plus.google.com/100089265708813302694/posts/eJ5EevKA2y3 for the detailed info that led to this epiphany.
mac  osx  sysadmin  nfs  automount  autofs  diskutility  errrormessage  solution 
january 2014 by kme
Automount NFS in OS X | Your Mac / Linux Guy
The only way I’ve found this to work – with limitations; see below – is to instead append `browse` to the `AUTOMOUNTD_MNTOPTS=…` line in `/etc/autofs.conf`; e.g.
AUTOMOUNTD_MNTOPTS=nosuid,nodev,browse

This causes automounted mounts to behave as follows – WHILE ACTUALLY MOUNTED:

* They show up *individually* on the Desktop – assuming the Finder option to show connected servers on the Desktop is turned on.
* in the Finder sidebar, only the *server* – not the individual mounts – shows up in category Shared as connected – implied by the eject icon next to it – assuming you have the Finder option to show connected servers in the sidebar turned on.
* Also note that if you eject the server via the Finder sidebar, the icons disappear from the Desktop – yet, the shares will continue to be accessible, by virtue of being automounts that reconnect on demand.


Another useful tidbit, although unrelated to the problem I was having:
One last thing to mention. You will probably wish to disable the creation of .DS_Store files on network volumes when using automounts. The Finder has a bad habit of leaving these files open, so your automounted shares will not unmount after set idle times like they’re supposed to. To keep your Mac from writing .DS_Store files to network drives, run the following defaults command in the terminal. This is a per-user setting.

defaults write com.apple.desktopservices DSDontWriteNetworkStores true
automount  autofs  nfs  mac  osx  finder  maybesolution  DS_Store  annoyance  networking 
january 2014 by kme
10.6: Add NFS Mounts using Disk Utility - Mac OS X Hints
This is getting me soooo close. Turns out the 'nobrowse' command is passed to these automounts by default, so they don't show up in Finder, but I want that. Evidence suggests that '-o browse' might work ordinarily, but when I restart automountd (see http://apple.stackexchange.com/questions/20050/how-to-reload-autofs-on-lion-without-restarting) I get this error:
Assertion failed: (strlcat((mntops_out), (","), (optlen)) < (optlen)), function process_fstab_mntopts, file /SourceCache/autofs/autofs-207.1/automountlib/ns_fstab.c, line 171.


Solution at http://www.opensource.apple.com/source/autofs/autofs-207.1/automountlib/ns_fstab.c - yes, those "Advanced Mount Parameters" are passed as comma-separated options to '-o'. Unsure whether '-o browse,nobrowse' will cancel and blow up the computer or not.

NB: This capability was removed from Disk Utility in Mountain Lion (10.8). There's a third party (non-free) utility called NFSManager (http://www.bresink.com/osx/NFSManager.html) which can fill the gap, or you can manually create these mount points using Directory Services utilities (see https://plus.google.com/100089265708813302694/posts/eJ5EevKA2y3)
nfs  mac  osx  lion  automount  autofs  diskutility  maybesolution  errormessage 
january 2014 by kme
services - How to reload autofs on Lion without restarting? - Ask Different
this works for me:

sudo automount -vc

Problem being, the 'service' command was removed in Lion or something, so:
sudo service com.apple.autofsd stop
sudo service com.apple.autofsd start

doesn't work anymore, but this does:
You can use launchctl instead of service:

sudo launchctl stop com.apple.autofsd
autofs  automount  nfs  mac  osx  service  solution 
january 2014 by kme

Copy this bookmark:





to read