User Tools

Site Tools


quickreference:nfs

This is an old revision of the document!


NFS Quick Reference

Some useful commands

Finding mounts we can use

If you put the server's IP address (or DNS name) below, it will show all NFS mounts available to your machine

showmount -e serverip

restart nfsd

nfs on FreeBSD is very particular in which order you restart the services. In particular, rpcbind must be the first service restarted. To restart the entire system, use the following. Under normal circumstances, this will not be noticed by the client machines.

service rpcbind restart
service nfsd restart
service mountd restart
service lockd restart

lockd

lockd not starting

lockd can get messed up (on FreeBSD server). It says it starts, but it doesn't. In /var/log/messages, you'll see the line:

Can't start NLM - unable to contact NSM

This is because of a corrupt statd file. You can fix the problem, generally, with the following commands taken from https://forums.freebsd.org/threads/failed-to-contact-local-nsm-rpc-error-5.16474/

service statd stop
service lockd stop
rm /var/db/statd.status
service statd start
service lockd start

Checking Lock Status

Subversion hung when I ran it off an NFS mount. Took a while to track down, but it turns out subversion wants a lock on some files whenever you do a checkout/update/commit. Sounds reasonable.

I had locking installed and configured, but it was not running on my server (FreeBSD).

service lockd status

Started the service (service lockd start) and subversion did its job within a few seconds.

Locking

I had a situation where an application (subversion) would hang. Took a while to track down. Turns out, subversion locks files on checkout, update and commit (sound reasonable) and, it will wait forever for the lock.

My server (FreeBSD) had lockd installed but I had never started it. Following command showed me that, so I started it, and all of a sudden, subversion got its lock and did its thing.

service lockd status

Sample rc.conf

### NFS
 
# enable rpcbind server
rpcbind_enable="YES"
 
# enable nfs server (v3)
nfs_server_enable="YES"
 
# comment out the enable nfsv4 server
# nfsv4_server_enable="YES"
 
# enable mountd (required)
mountd_enable="YES"
 
# set flags for mountd (man 8 mountd)
# -h binds nfsd to a specific IP, so a machine with
#    multiple IP's will only respond if this one is used for the
#    request.
# -r allow a file to be mounted
# -p bind mountd to a particular port
mountd_flags="-r -h 10.244.118.19 -p 59758"
 
# enable lockd
# uncomment the following lines if server side file locks are
# needed. Note you must replicate this on the clients
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
 
# parameters for statd (man 8 rpc.statd)
# -d send debugging to syslog
# -p use static port
# -h IP - bind to IP address
 
rpc_statd_flags="-d -p 59757"
 
# parameters for lockd (man 8 rpc.lockd)
# -d send debugging to syslog
# -p use static port
# -h IP - bind to IP address
rpc_lockd_flags="-d 10 -p 59759"
quickreference/nfs.1741499922.txt.gz · Last modified: 2025/03/08 23:58 by rodolico