# mount -t nfs vlager:/home /users
mount will try to connect to the rpc.mountd mount daemon on
When someone accesses a file over NFS, the kernel places an RPC call to rpc.nfsd (the NFS daemon) on the server machine. This call takes the file handle, the name of the file to be accessed, and the user and group IDs of the user as parameters. These are used in determining access rights to the specified file. In order to prevent unauthorized users from reading or modifying files, user and group IDs must be the same on both hosts.
On most Unix implementations, the NFS functionality of both client and server is implemented as kernel- level daemons that are started from user space at system boot. These are the
The current NFS implementation of Linux is a little different from the classic NFS in that the server code runs entirely in user space, so running multiple copies simultaneously is more complicated. The current rpc.nfsd implementation offers an experimental feature that allows limited support for multiple servers. Olaf Kirch developed kernel-based NFS server support featured in 2.2 Version Linux kernels. Its performance is significantly better than the existing userspace implementation. We'll describe it later in this chapter.
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
$ cat /proc/filesystems
minix
ext2
msdos
nodev proc
nodev nfs
If
Mounting an NFS Volume
The mounting of NFS volumes closely resembles regular file systems. Invoke mount using the following syntax:[81]
# mount -t nfs
There are a number of additional options that you can specify to mount upon mounting an NFS volume. These may be given either following the
Here is a sample entry from
# volume mount point type options
news:/var/spool/news /var/spool/news nfs timeo=14,intr
This volume can then be mounted using this command:
# mount news:/var/spool/news
In the absence of an
# mount moonshot:/home /home -o rsize=8192,wsize=8192
The list of all valid options is described in its entirety in the
These specify the datagram size used by the NFS clients on read and write requests, respectively. The default depends on the version of kernel, but is normally 1,024 bytes.
This sets the time (in tenths of a second) the NFS client will wait for a request to complete. The default value is 7 (0.7 seconds). What happens after a timeout depends on whether you use the
Explicitly mark this volume as hard-mounted. This is on by default. This option causes the server to report a message to the console when a major timeout occurs and continues trying indefinitely.
Soft-mount (as opposed to hard-mount) the driver. This option causes an I/O error to be reported to the process attempting a file operation when a major timeout occurs.
Allow signals to interrupt an NFS call. Useful for aborting when the server doesn't respond.
Except for
By default, a major timeout causes the client to print a message to the console and start all over again, this time with an initial timeout interval twice that of the previous cascade. Potentially, this may go on forever. Volumes that stubbornly retry an operation until the server becomes available again are called
