My existing setup breaks the FreeBSD NFS startup. So I took what
FreeBSD does and took it for my own. The normal /etc/rc.conf options I
used in for enabling NFS are these:
nfs_server_enable="YES" # This host is an NFS server (or NO)
nfs_server_flags="-u -t -n 4" # Flags to nfsd (if enabled).
nfs_client_enable="YES" # This host is an NFS client (or NO).
nfs_client_flags="-n 4" # Flags to nfsiod (if enabled).
These options are used by the script /etc/rc.network. If the above
options exist in , In that file, you'll find a section which starts like this:
network_pass3() {
echo -n 'Starting final network daemons:'
case ${nfs_server_enable} in
[Yy][Ee][Ss])
if [ -r /etc/exports ]; then
echo -n ' mountd'
case ${weak_mountd_authentication} in
[Yy][Ee][Ss])
mountd_flags="-n"
;;
esac
This is the section which I took for my own. Basically, I cobbled togther the
bits and pieces I needed. My script is:
#!/bin/sh
#
# start the nfs server
#
echo -n ' mountd' ; mountd -r
echo -n ' nfsd' ; nfsd -u -t -n 4
echo -n ' sysctl' ; sysctl -w vfs.nfs.bufpackets=DEFAULT \
> /dev/null
echo -n ' rpc.statd' ; rpc.statd
#
# then mount our NFS client volumes
#
mount -v fred:/nzmirror/ports/distfiles /usr/ports/distfiles
The steps I go through in the above script more or less duplicate what the /etc/rc.network
when it sees the NFS options I described at the start of this section.
This script is placed in /usr/local/etc/rc.d/nfs.sh. Make sure it is
chmod 750. |