[Discuss] NFS client difference between Solaris and Linux

Jerry Natowitz j.natowitz at rcn.com
Wed Nov 2 14:26:38 EDT 2011


I work with a number of Linux systems (Fedora 12) and Solaris systems (8 and 10).  I want to be able to monitor the status of NFS mounts - sometimes systems are taken down while another system is actively using an NFS export from that system.

While writing a script to monitor the health of the NFS mounts on a system, I discovered that the following shell constructs work differently in Linux and Solaris 10 (haven't looked at Solaris 8 yet):

csh:
if ( -d /home/foo ) echo foo
if ( -e /home/foo ) echo foo
if ( ! -d /home/foo ) echo no foo
if ( ! -e /home/foo ) echo no foo


sh/bash:
[ -d /home/foo ] && echo foo
[ -d /home/foo ] || echo no foo

On Linux, the commands will cause the system to attempt to make the NFS mount, and return the status of that mount.  If the server is offline, the mount attempt does not hang.

On Solaris, the commands will check to see if /home/foo is defined in /etc/auto_home and return the status of that lookup.  No mount is attempted, so that 

/home is defined the same on both systems:
/home   /etc/auto.home	-nobrowse,retry=3,suid

If I use this test:
[ -f /home/foo/. ]  || echo foo

Linux continues to work as before.  Solaris does actually attempt the mounts, but if the server is offline, the mount attempt hangs.




More information about the Discuss mailing list