Working With NFS Clients

From a client computer, you need to know the available shared directories, the right way to mount these directories, and how to configure these directories to mount automatically the next time Linux boots on your computer.

Listing Shared Directories

It s easy to list the shared directories from an NFS server. All you need is the hostname or IP address of the server. The following command gives you the current list of shared directories from the computer named RHL9:

 #  showmount -e RHL9  Export list for RHL9: /home/gb RHL9* /tmp     * 

You can use the showmount -e command on the NFS server to make sure that it is actually exporting the directories that you want to share through /etc/exports .

This command lists two shared directories, along with the computers that are allowed to connect to each directory. If the list is not accurate, or the command does not work, take the following steps:

Check the daemons on the server. Are the nfs , portmap , and mountd daemons running?

Inspect the firewalls on both the server and the client. Are any iptables commands blocking ports 111 and 2049? Are some of the NFS services blocked in /etc/ hosts .deny ?

Verify that you exported the directories in /etc/exports . On the NFS server, run the showmount -e command. Remember, if you ve just modified this file, you ll need to run the exportfs -r command on the server to refresh the export list.

If all else fails, refer to the discussion in Chapter 21 on network troubleshooting. While commands are available for testing network connectivity, the most common cause of network problems is the physical connections.

Mounting a Shared NFS Directory

Assuming everything is all right on the server, try the showmount -e NFSserver command again. Once you see the export list, you can mount one of these directories on your Linux computer. The following example mounts the /tmp directory from the computer named RHL9 on the local computer s /tmp directory:

 # mount -t nfs RH81:/tmp /tmp 

To translate, this mounts an NFS ( -t nfs ) filesystem, the /tmp directory from RHL9 on the local /tmp directory. But if there is a problem on the NFS server, or on the network connection, risks are involved. Suppose your connection " hangs ," which locks up your console. Your computer will keep trying to connect, even if the NFS server has disappeared. Thus, a command with options ( -o ) like the following is preferred:

 # mount -t nfs -o soft,intr,timeo=50 RH81:/tmp /tmp 

This adds options to soft mount, interruptible by the NFS server, with a timeout ( timeo ) of 50 tenths of a second (which of course corresponds to 5 seconds). But as discussed in Chapter 07 , this command can be simplified. You can enter mount information in /etc/fstab :

 RHL9:/tmp    /tmp    nfs    soft,intr,timeo=50  0 0 

Then all you would need to run to mount the shared /tmp directory is this command:

 # mount /tmp 

Mastering Red Hat Linux 9
Building Tablet PC Applications (Pro-Developer)
ISBN: 078214179X
EAN: 2147483647
Year: 2005
Pages: 220 © 2008-2017.
If you may any questions please contact us: