NFS Workarounds

From OS X Scientific Computing

Contents

If things are problematic

I've had trouble with mounting filesystems from non-OS X machines (linux and sun, which used to work fine), and with exporting file systems, as briefly noted above.



Tweak for mounting non-OS X filesystems

The good folks at Apple suggested I do the following to make automounts work for my linux and sun filesystems:

Change

AUTOMOUNTD_MNTOPTS=nosuid,nodev

in /etc/autofs.conf to

AUTOMOUNTD_MNTOPTS=nosuid,nodev,resvport



Workarounds for exporting NFS filesystems

When I set up exports in /etc/exports (the same way that worked in 10.4.11 and earlier), the export would not work on reboot, but nfsd is running. I had to restart the nfsd, and then it does the right thing. It worked fine in 10.1.X through 10.4.X. Now it is controlled by launchd instead of a startup item. In principle, this is an improvement. However, Launchd obviously starts nfsd, but the export doesn't work. Here are the symptoms:


% showmount -e
Exports list on localhost:
(nothing)

% sudo nfsd start     
The nfsd service is already running.

% showmount -e
Exports list on localhost:
(nothing)

% sudo nfsd restart

% showmount -e     
Exports list on localhost:
/Users                             the.other.computer


Here is what is in my /etc/exports file:

/Users  -maproot=nobody  the.other.computer


Two possible workarounds

Add entries to the /etc/hosts file

This will allow ip addresses to be resolved almost instantly.

Edit /etc/hosts and add lines such as

123.124.423.87   somewhere.overthe.rainbow

that correspond to what is in your /etc/exports file.


Create a LauncDaemon to restart nfsd

This also works:


First I made an xml launchd file called /Library/LaunchDaemons/nfsd.plist

It looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
            <false/>
        <key>Label</key>
            <string>edu.ucsc.nfsd</string>
        <key>OnDemand</key>
            <true/>
        <key>RunAtLoad</key>
            <true/>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/local/bin/restart_nfsd</string> 
        </array>
        <key>ServiceDescription</key>
            <string>restart nfs exports</string>
</dict>
</plist>


and then I made this executable shell script /usr/local/bin/restart_nfsd with this in it:

#!/bin/sh
 
sleep 60
/sbin/nfsd restart


The delay seems to be key to getting this to work, making me suspect some sort of disk arbitration issue.


Finder Crashing When Browsing Mounted Filesystems

I noticed with non-OS X mounted filesystems, Finder would crash when I tried to browse them. After I deleted all the ._* and .DS_Store files that OS X generated on these filesystems (apparently prior to the 10.5 upgrade), the Finder crashing problem went away.


Back to NFS on OS X 10.5