20.3.1 NFS
/etc/exports contains the list of system directories to export, who has access to them, and the nature of the access (e.g. rw or ro, root, etc.). A file server might have the following exports file to service diskless and dataless clients of multiple hardware architectures.
/home -access=nyssa:blueagle:leela
/usr -root=blueagle,access=blueagle
/usr/local -root=nyssa,access=nyssa:blueagle
/usr/sun3/local -access=leela
/var/spool/mail -access=nyssa:blueagle:leela
/export/share -access=blueagle:leela:nyssa
/export/exec/sun3x.sunos.4.1.1 -access=leela
/export/exec/kvm/sun4c.sunos.4.1.4 -access=blueagle
/export/exec/kvm/sun3x -access=leela
/export/root/leela -root=leela,access=leela
/export/root/swap/leela -root=leela,access=leela
/export/root/blueagle -root=blueagle,access=blueagle
/export/swap/blueagle -root=blueable,access=blueagle
If you don't specify restrictions it defaults to allow read/write access to all, e.g. if exports contains:
/
your root directory is accessible to everyone on the net.
After you edit /etc/exports to make the directories mountable by other systems you need to run:
# /usr/etc/exportfs -a
The server needs to run the NFS mount daemon, rpc.mountd, and several NFS service daemons, nfsd (typically 8 for a low use server). These two daemons handle NFS mount requests and client requests, respectively. NFS also requires that the block IO daemons, biod, be running (normally 4 are started) to buffer read-ahead and write-behind requests. These are used for all client requests, both local and through NFS. The block IO daemons are always started by rc.local; the other NFS daemons started for the server during boot by rc.local only if /etc/exports exists. The relevant lines in rc.local are:
if [ -f /usr/etc/biod ]; then
biod 4; (echo -n ' biod') >/dev/console
fi
if [ -f /etc/exports ]; then
> /etc/xtab
exportfs -a >/dev/console
nfsd 8 & (echo -n ' nfsd') >/dev/console
rpc.mountd -n >/dev/console
fi
If you create an exports file later you will need to start these by hand before your system can become a server.
The file /etc/xtab contains the list of files actually exported via exportfs. If you execute exportfs without any options it will display this list.
You can use the showmount command to see who is mounting your file systems, though it's not a very accurate representation of the current state.