some notes about NFS

by iman

hi. here r some tips which i collected for my daily use of NFS. hopes helpful …😉 .

some usefull commands :
# nfsstat -m     -Print information about each of the mounted NFS file systems. (install it with : apt-get install nfs-common)
# nfsstat -c        – A high number of NFS retransmissions can be detected
# nfsstat -r        – to see the current nfst statistics for retranmission of packets
# netstat -s       – Display summary statistics for each protocol.
# netstat -i        – To get the current value of your MTU
# showmount    – show mount information for an NFS server

Manually mounting with the mount command
# mount -t nfs -o hard,intr,rw,rsize=131072,wsize=131072   <nfs-ip-server>:/volume/<path>  /<my-path-to-mount>

or add following command in /etc/fstab to mount :
<nfs-ip-server>:/volume/<path>       /<my-path-to-mount>           nfs              hard,intr,rw,rsize=131072,wsize=131072   0 0

((( Common NFS Mount Options )))

  1. rsize=num and wsize=num — These settings speed up NFS communication for reads (rsize) and writes (wsize) by setting a larger data block size, in bytes, to be transferred at one time. Be careful when changing these values; some older Linux kernels and network cards do not work well with larger block sizes. For NFSv2 or NFSv3, the default values for both parameters is set to 8192. For NFSv4, the default values for both parameters is set to 32768.
  2. intr — Allows NFS requests to be interrupted if the server goes down or cannot be reached.
  3. hard or soft — Specifies whether the program using a file via an NFS connection should stop and wait (hard) for the server to come back online, if the host serving the exported file system is unavailable, or if it should report an error (soft).  If hard is specified, the user cannot terminate the process waiting for the NFS communication to resume unless the intr option is also specified.    If soft is specified, the user can set an additional timeo=<value> option, where <value> specifies the number of seconds to pass before the error is reported. Note:Using soft mounts is not recommended as they can generate I/O errors in very congested networks or when using a very busy server.
  4. nfsvers=2 or nfsvers=3 — Specifies which version of the NFS protocol to use. This is useful for hosts that run multiple NFS servers. If no version is specified, NFS uses the highest supported version by the kernel and mount command. This option is not supported with NFSv4 and should not be used.
  5. tcp — Specifies for the NFS mount to use the TCP protocol.
  6. udp — Specifies for the NFS mount to use the UDP protocol.

so which one to use:  It is strongly recommended to use NFS over TCP where possible, since TCP does not perform fragmentation. because Using NFS over UDP on high-speed links such as Gigabit can cause silent data corruption (refer to nfs manual page).