NFS introducation

Ø  NFS, the network filesystem, is probably the most prominent network services using RPC. It allows to access files on remote hosts in exactly the same way as a user would access any local files. This is made possible by a mixture of kernel functionality on the client side (that uses the remote file system) and an NFS server on the server side (that provides the file data). This file access is completely transparent to the client, and works across a variety of server and host architectures.
NFS offers a number of advantages:
Data accessed by all users can be kept on a central host, with clients mounting this directory at boot time. For example, you can keep all user accounts on one host, and have all hosts on your network Ø  mount /home from that host. If installed alongside with NIS, users can then log into any system, and still work on one set of files.
Ø  Data consuming large amounts of disk space may be kept on a single host. For example, all files and programs relating to LaTeX and METAFONT could be kept and maintained in one place.
Ø  Administrative data may be kept on a single host. No need to use rcp anymore to install the same stupid file on 20 different machines.

Preparing NFS
Ø  Before you can use NFS, be it as server or client, you must make sure your kernel has NFS support compiled in. Newer kernels have a simple interface on the proc filesystem for this, the /proc/filesystems file, which you can display using cat:
          $ cat /proc/filesystems
          minix
          ext2
          msdos
nodev   proc
          nodev   nfs
Ø  If nfs is missing from this list, then you have to compile your own kernel with NFS enabled. Configuring the kernel network options is explained in section ``Kernel Configuration'' .
Ø  For older kernels prior to -1.1, the easiest way to find out whether your kernel has NFS support enabled is to actually try to mount an NFS file system. For this, you could create a directory below /tmp, and try to mount a local directory on it:
     # mkdir /tmp/test
     # mount localhost:/etc /tmp/test
Ø  If this mount attempt fails with an error message saying ``fs type nfs no supported by kernel'', you must make a new kernel with NFS enabled. Any other error messages are completely harmless, as you haven't configured the NFS daemons on your host yet.

Mounting an NFS Volume

Ø  NFS volumes are mounted very much the way usual file systems are mounted. You invoke mount using the following syntax:
              # mount -t nfs nfs volume local dir options
 nfs_volume is given as remote_host:remote_dir. Since this notation is unique to NFS file systems, you can leave out the -t nfs option.
Ø  There are a number of additional options that you may specify to mount upon mounting an NFS volume. These may either be given following the -o switch on the command line, or in the options field of the /etc/fstab entry for the volume. In both cases, multiple options are separated from each other by commas. Options specified on the command line always override those given in the fstab file.
Ø  A sample entry in /etc/fstab might be
     # volume              mount point       type  options
     news:/usr/spool/news  /usr/spool/news   nfs   timeo=14,intr

Ø  In the absence of a fstab entry, NFS mount invocations look a lot uglier. For instance, suppose you mount your users' home directories from a machine named moonshot, which uses a default block size of 4K for read/write operations. You might decrease block size to 2K to suit ' datagram size limit by issuing
     # mount moonshot:/home /home -o rsize=2048,wsize=2048

Ø  The list of all valid options is described in its entirety in the nfs(5) manual page that comes with Rick Sladkey's NFS-aware mount tool which can be found in Rik Faith's util-linux package). The following is an incomplete list of those you would probably want to use:

   rsize = n and wsize = n
These specify the datagram size used by the NFS clients on read and write requests, respectively. They cur- rently default to 1024 bytes, due to the limit on UDP datagram size described above.

  timeo = n
This sets the time (in tenths of a second) the NFS client will wait for a request to complete. The default values is 0.7 sec- onds.
  hard
Explicitly mark this volume as hard-mounted. This is on by default.
  soft
Soft-mount the driver (as opposed to hard-mount).
  intr
Allow signals to interrupt an NFS call. Useful for aborting when the server doesn't respond.