Solaris NFS

Developed by Sun Microsystems in 1983 the main purpose of the Network File System (NFS) is to share file systems under hydrogenous environment of machine running with different platforms.

NFS versions

NFS uses the RPC protocol for communicating between the NFS server and NFS clients.

To determine what version and transport of NFS is currently available, run rpcinfo on the NFS server.

# rpcinfo -p | grep 100003 
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs

From the about output the second column shows the NFS version and the third column is the transport protocol.

Sun has implemented the following versions of NFS on it?s operating systems, for both client and server:

Version Released Solaris release Comments
NFSv1 1984 Sun used NFSv1 only for in-house experimental purposes. It was never released outside of Sun.
NFSv2 1989 (RFC1094) SunOS 4.x, Solaris 2.0 onwards In NFSv2 clients needed to wait ~30 seconds to access modified data from the server. Data transfer speeds between server and client ~8kb. Unable to share file systems size greater than 2GB
NFSv3 1995 (RFC1813) default in Solaris 8, 9 & 10. In NFSv3 the wait time is less than 30 seconds, data transfer increased to ~32kb and provided an unlimited file system share size.
NFSv4 2000 (RFC3010), 2003 (RFC3530) introduced in Solaris 10 NFSv4 provides state full connections, improved firewall support and has a reduced number of server side daemons allowing for easier troubleshooting.

Files

File Description
/etc/dfs/dfstab contains all shared file system at boot time (we manually edit the file)
/etc/dfs/sharetab contains all exported file system to the kernel
/etc/rmtab contains all remote clients who are accessing the NFS share
/etc/default/fs contains default file system information
/etc/fstypes contains all file system which are supported by the Solaris OS
/etc/nfs/nfslogd.conf contains all nfs log messages
/etc/default/nfslogd complete configuration information about NFS log messages for the nfslogd daemon
/etc/default/nfs contain the complete information about nfs protocol and nfs daemons

Daemons

Daemon Description
rpcbind The RPC portmapper
mountd This is an RPC server that handles file system mount requests from remote systems. It checks /etc/dfs/sharetab to determine which file systems are available for remote mounting and which systems are allowed to do the remote mounting.
nfsd The nfsd daemon handles other client file system requests.
statd This statd daemon works with the lockd daemon to provide crash recovery functions for the lock manger. It keeps track of the clients that hold locks on a NFS server
lockd This lockd daemon supports record locking operation on NFS files. It will send locking requests from the client to the NFS server. On the NFS server, it will start local locking.
nfsmapid Its responsible for mapping nfs uid and nfs gid
nfs4cbd It?s a daemon for NFS version 4 which is call backs the request. If NFS server does not response for a specific period of time
nfslogd This nfslogd daemon provides operational logging

Note: nfs4cbd and nfsmapid — Solaris 10 only. Solaris 11 uses idmap daemon instead of nfsmapid.

Sharing from the NFS server

Solaris 8, 9 & Solaris 10

share -F nfs -o [options] <share-path>

For example: share /oradata mount point as r/w to hosts orasys1 and orasys2 only. We use:

# share -F nfs -o rw=orasys1:orasys2 /oradata

Solaris 10 with ZFS

Similar example but for Solaris 10 with ZFS file system:

# zfs set sharenfs="rw=orasys1:orasys2" orapool/oradata>

Solaris 11 with ZFS

Under Solaris 11, the ZFS syntax is different than Solaris 10 as we need to name the share whilst sharing it:

# zfs set sharenfs=on orapool/oradata
# zfs set share=name=oradata,path=/oradata,prot=nfs,rw=orasys1,orasys2 orapool/oradata>

Mounting from the NFS client

To mount the NFS share manually on the NFS client, we use the syntax:

mount -F nfs -o [options] <nfs-server>:<mountpoint>

To make NFS mount points persistent across reboots, we add the entries into /etc/vfstab file on the NFS client. For example:

#device                device    mount     FS     fsck   mount     mount
#to mount              to fsck   point     type   pass   at boot   options
192.168.1.12:/oradata  -         /oradata  nfs    -      yes       rw,bg,vers=3

Using dfstab

In using the /etc/dfs/dfstab file we make sure that shares are persistent across reboots. The basic syntax for an NFS entry is:

share -F nfs -o rw=<host> -d "<share-description>" <mount-point>

Once entries are added to the dfstab file, we use the shareall and unshareall commands to share/unshare the entries mentioned:

Start/Stop NFS server

Solaris 8 and 9

# /etc/init.d/nfs.server start
# /etc/init.d/nfs.server stop

Solaris 10

# svcadm enable svc:/network/nfs/server:default
# svcadm disable svc:/network/nfs/server:default

Troubleshooting NFS

Whilst there are many commands to gather NFS share information. Below are the 3 most common:

Command Description
share Use the share command on NFS server to display the current shares with all the options
showmount -e The showmount -e command contacts the mountd daemon and lists all the shares with options.
dfshares The dfshare command displays the same information as showmount -e but in a different format.

Common error while configuring NFS:-

  • RPC binding failure
  • RPC program not register
  • Client reboots error
  • Stale handles error
  • Resource not found
  • Mount error

Review my other post on Troubleshooting various NFS errors for more details.