NFS Client Networking  «Prev  Next»
Lesson 4 Client-side NFS mounting
Objective Use the mount command to access NFS shares.

Client-side NFS Mounting in Red Hat

You must mount[1] a remote NFS volume before accessing its contents, just like you must mount local drives. In its simplest form, there is only one difference between mounting an NFS volume and a local volume with the mount command: you must specify the machine the volume is on.

Using the mount command in Red Hat

For example, you might work on a project and use NFS to put all information relating to this project into a single directory called /proj1home on the machine projecthost. Then when you work on the project from the host host05, you gain access to the project directory by typing:

mount projecthost:/proj1home /mnt/currentproject

The directory /mnt/currentproject must exist on host05 before issuing this command. Now, whenever you access files or directories under /mnt/currentproject, you actually access the contents of projecthost's /proj1home directory structure. If you want to unmount NFS volumes, you execute it just like any other mounted filesystems.
For example, if you wanted to unmount /mnt/currentproject you would type:

umount /mnt/currentproj

Efficient data transfer

When computers communicate over networks, they split data into packets of information with a limit on size. NFS usually breaks up information into 4- or 8-KB chunks. This may, however, be too large for the network hardware, so the NFS data is in turn broken up into even smaller pieces, sent to the destination, and then reconstructed on the receiving end. This process is not efficient. Instead, you can tell NFS to send smaller packets that don't need as much modification before they are actually sent.

Mounting options

Two options used with the mount command control the size of the packets you send: rsize and wsize. rsize sets the read block size and wsize sets the write block size.
For example, if you want to tell the NFS client to mount the directory in information blocks of only 1 KB, you would use the following command line:

mount -o rsize=1024,wsize=1024 projecthost:/proj1home /mnt/currentproject

The -o signifies that one or more options follow, separated by commas.

The timeo=n option

If a client makes a request for NFS information and does not receive a response within a certain timeout period, Linux repeats the request. The length of time your computer waits for a response can be set with the timeo=n option, where "n" is the length of the timeout in tenths of a second. For example, to tell Linux to wait a full second, instead of the default 0.7 seconds, type:

mount -o timeo=10 projecthost:/proj1home /mnt/currentproject

Every time a request is repeated, the timeout value is doubled, but is never allowed to exceed 60 seconds. Unless you interrupt the program that is requesting the information, a client that does not receive responses will repeat requests indefinetely.

Using the fstab file to define mountable file systems

The hard disks on your local computer and the remote file systems you use every day are probably set up to automatically mount when you boot Linux. The definitions for which of these file systems are mounted are contained in the /etc/fstab file. Here’s an example of an /etc/fstab file:
Example of an /etc/fstab file
Example of an /etc/fstab file

All file systems that are listed in this file are mounted at boot time, except for those that are set to noauto in the fourth field. In this example, the root (/) and boot (/boot) hard disk partitions are mounted at boot time, along with the /proc and /dev/pts file systems (which are not associated with particular devices). The floppy disk (/dev/fd0) and CD−ROM drives (/dev/cdrom) are not mounted at boot time. Definitions are put in the fstab file for floppy and CD−ROM drives so that they can be mounted in the future (as described later). I also added one additional line for /dev/hda1, which allows me to mount the Windows (vfat) partition on my computer so I don't have to always boot Windows to get at the files on my Windows partition.
The next lesson shows you how to use /etc/fstab to automate the NFS client-side mounts.

[1] Mount: To create a link from a directory name in the root hierarchy to a source of information. Sources of information include hard-disks, CD-ROMs, floppies, and drives on networked computers.