A service of Daily Data, Inc.
Contact Form

User Tools

Site Tools


quickreference:nfs

Differences

This shows you the differences between two versions of the page.


quickreference:nfs [2025/03/09 00:01] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== 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
 +<code bash>
 +showmount -e serverip
 +</code>
 +
 +==== 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.
 +
 +<code bash>
 +service rpcbind restart
 +service nfsd restart
 +service mountd restart
 +service lockd restart
 +
 +</code>
 +
 +
 +===== 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:
 +<code>Can't start NLM - unable to contact NSM</code>
 +
 +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/]]
 +<code bash>
 +service statd stop
 +service lockd stop
 +rm /var/db/statd.status
 +service statd start
 +service lockd start
 +</code>
 +
 +==== 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).
 +<code bash>
 +service lockd status
 +</code>
 +
 +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.
 +<code bash>
 +service lockd status
 +</code>
 +
 +===== Sample rc.conf =====
 +
 +<code autoconf rc.conf.nfs>
 +### NFS
 +
 +# enable rpcbind server
 +rpcbind_enable="YES"
 +
 +# enable nfs server (v3)
 +nfs_server_enable="YES"
 +
 +# uncomment to 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 (helps with firewalls)
 +mountd_flags="-r -h 10.10.10.10 -p 59000"
 +
 +# 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 (helps with firewalls)
 +# -h IP - bind to IP address
 +
 +rpc_statd_flags="-d -p 59001"
 +
 +# parameters for lockd (man 8 rpc.lockd)
 +# -d send debugging to syslog
 +# -p use static port (helps with firewalls)
 +# -h IP - bind to IP address
 +rpc_lockd_flags="-d 10 -p 59002"
 +</code>
quickreference/nfs.1718068777.txt.gz · Last modified: (external edit)