Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
NFS Services Administrator's Guide: HP-UX 11i version 3 > Chapter 2 Configuring and Administering NFS Services

Configuring and Administering NFS Clients

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

An NFS client is a system that mounts remote directories using NFS. When a client mounts a remote filesystem, it does not make a copy of the filesystem. The mounting process uses a series of remote procedure calls that enable the client to transparently access the filesystem on the server’s disk. To users, these mounted remote directories appear as if they are a part of the local filesystem. An NFS client can also be an NFS server. NFS filesystems can also be automounted using AutoFS. For information on how to automount a filesystem, see Chapter 3 “Configuring and Administering AutoFS”.

NFS Client Configuration Files and Daemons

This section describes the NFS client configuration files and daemons.

Configuration Files

Table 2-5 “NFS client configuration files” describes the NFS configuration files and their functions.

Table 2-5 NFS client configuration files

File Name

Function

/etc/mnttabContains the list of filesystems that are currently mounted.
/etc/dfs/fstypesContains the default distributed filesystem type.

/etc/fstab

Contains the list of filesystems that are automatically mounted at system boot time.

 

Daemons

Table 2-5 describes the NFS client daemons and their functions.

Table 2-6 NFS client daemons

Daemon Name

Function

rpc.lockd

Supports record lock and share lock operations on the NFS files.

rpc.statd

Maintains a list of clients that have performed the file locking operation over NFS against the server. These clients are monitored and notified in the event of a system crash.

 

Following are the tasks involved in configuring and administering an NFS client.

Configuring the NFSv4 Client Protocol Version

IMPORTANT: The nfsmapid daemon must be running on both the NFS server and the client to use NFSv4. For more information on how to configure the NFSv4 server protocol version, see “Configuring the NFSv4 Server Protocol Version ”.

By default, the version of the NFS protocol used between the client and the server is the highest one available on both systems. On HP-UX 11i v3, the default maximum protocol version of the NFS server and client is 3. The default minimum protocol version of the NFS server and client is 2.

To configure the NFS client to enable it to mount filesystems using protocol version 4 (NFSv4), follow this step:

Set the value of the NFS_CLIENT_VERSMAX variable to 4 in the /etc/default/nfs file, as follows:

NFS_CLIENT_VERSMAX = 4

The NFS_CLIENT_VERSMAX variable specifies the maximum version of the NFS protocol for communication.

You can also configure the client protocol version to NFSv4 by specifying vers=4 while mounting the directory. For example, to set the client protocol version to NFSv4 while mounting the /usr/kc directory, enter the following command:

mount -o vers=4 serv:/usr/kc /usr/kc

For more information on NFSv4, see nfsd(1m), mount_nfs(1m), nfsmapid(1m), and nfs4cbd(1m).

Deciding Between Standard-Mounted Directories and Automounted Directories

Before you mount any remote directories on a local system, decide whether you want each directory to be standard-mounted or automounted. You can automount directories using AutoFS. For more information on AutoFS, see Chapter 3 “Configuring and Administering AutoFS”.

Table 2-7 “Standard-Mounted Versus Automounted Directories” lists the differences between the Standard-Mounted and the Automounted directories.

Table 2-7 Standard-Mounted Versus Automounted Directories

Standard-Mounted Directory

Automounted Directory (Using AutoFS)

The directory stays mounted. You do not have to wait for it to be mounted after you issue a read or write request.

Automounted directories stay mounted until they are left idle for 10 minutes. The 10 minute time interval is the default value and is configurable.

If a directory is configured to be standard-mounted when the client system boots, and the NFS server for the directory is not booted yet, system startup is delayed until the NFS server becomes available. If the client and the server are configured to mount directories from each other at boot time, standard mounts can cause both systems to hang indefinitely.

A directory automounted with AutoFS is not mounted until a user or a process requests access to it. As a result, both the client and the NFS server are able to complete the boot process before attempting to mount the directory.

You must maintain the configuration file for standard mounts (/etc/fstab) separately on each NFS client.

You can manage AutoFS configuration files (maps) centrally through NIS and LDAP.

If you have to configure many similar standard mounts, you must configure them individually, because you cannot use wildcard characters or environment variables when you configure standard NFS mounts.

AutoFS allows you to use wildcard characters and environment variables in configuration files (maps) as shortcuts, when you are configuring many similar automounts.

Standard NFS mounts provide no shortcut for configuring all available remote directories. You must configure each directory separately. If the NFS servers change the directories they are exporting, you must change your local NFS client configuration.

AutoFS allows you to configure a special “built-in” map known as the -hosts map. This built-in map automounts all the exported directories from any NFS server on the network on the client system whenever anyone requests access to a directory on that server. The servers can change which directories they export, but your configuration remains valid.

 

Enabling an NFS Client

To enable an NFS client, follow these steps:

  1. In the /etc/rc.config.d/nfsconf file, set the value of NFS_CLIENT variable to 1, as follows:

    NFS_CLIENT=1
  2. Enter the following command to run the NFS client startup script:

    /sbin/init.d/nfs.client start

The NFS client startup script starts the necessary NFS client daemons, and mounts the remote directories configured in the /etc/fstab file.

Mounting Remote Directories

The mount command mounts a shared NFS directory from a remote system (NFS server).

You can mount a filesystem using the following methods:

  • Automatic Mounting at System Boot time

    To set up a filesystem for automatic mounting at system boot time, you must configure it in the /etc/fstab file. All filesystems specified in the /etc/fstab file are mounted during system reboot.

  • Manual Mounting

    When you manually mount a filesystem, it is not persistent across reboots or when NFS client restarts. If the NFS client is restarted or the system is rebooted, the filesystem must be mounted again after the reboot. To mount filesystems manually, you must run the mount command. For a list of mount options, see mount_nfs(1M).

Consider the following points before you mount a directory:

  • Before you mount a remote directory on a client system, you must configure the remote system as an NFS server and share the directory.

  • You must configure a local directory as the mount point for the NFS filesystem. HP recommends that the mount point not contain files and directories. However, if the local directory contains files and directories, they will be hidden and inaccessible while the remote directory is mounted.

Mounting a Remote Directory on an NFS client

To mount a directory on an NFS client, select one of the following methods:

Automatic Mount

To configure a remote directory to be automatically mounted at system boot, follow these steps:

  1. Add an entry to the /etc/fstab file, for each remote directory you want to mount on the client. Following is the syntax for the entry in the /etc/fstab file:

    server:remote_directory local_directory nfs defaults 0 0

    or

    server:remote_directory local_directory nfs option[,option...] 0 0
  2. Mount all the NFS file systems specified in the /etc/fstab file by entering the following command:

    /usr/sbin/mount -a -F nfs
  3. Verify that your filesystem is mounted by entering the following command:

    nfsstat -m

    An output similar to the following output is displayed:

    /mnt/nfs149 from nfs149:/Flags:vers=4,proto=tcp,sec=sys,hard,intr,link,symlink,devs,rsize=32768,wsize=32768,retrans=5,timeo=600Attr cache:acregmin=3,acregmax=60,acdirmin=30,acdirmax=60

    The directory that you have mounted must be present in this list.

Manual Mount

To mount your directories manually, follow these steps:

  1. To mount a remote directory manually, enter the following command:

    mount serv:directory_name directory-name 
  2. Verify if your filesystem is mounted by entering the following command:

    nfsstat -m

    An output similar to the following output is displayed:

    /opt/nfstest from hpnfsweb:/home/tester Flags:         vers=3,proto=udp,sec=sys,hard,intr,link,symlink,acl,devs,rsize=32768,wsize=32768,retrans=5,timeo=11 Attr cache:    acregmin=3,acregmax=60,acdirmin=30,acdirmax=60 Lookups:     srtt=33 (82ms), dev=33 (165ms), cur=20 (400ms)

    The directory that you have mounted must be present in this list.

For a list of mount options, see mount_nfs(1M).

Enabling Client-Side Failover

Using client-side failover, an NFS client can switch to another server if the server supporting a replicated filesystem becomes unavailable.

The failover is usually transparent to the user. Failover can occur at any time without disrupting the processes running on the client. Failover is only supported on read-only fileystems.

To mount a directory that has been replicated on multiple servers, enter the following command:

mount -o ro svr:dir_name srv:dir_name dir_name

If the first NFS server is down, the client accesses the second NFS server.

For example, to mount the Casey directory to replicated servers, enter the following command:

mount -o ro onc21:/home/Casey onc23:/home/Casey /Clay

If the NFS server onc21 is down, the client accesses NFS server onc23.

To verify if the failover is in effect, enter the following command:

nfsstat -m

An output similar to the following output is displayed:

/Clay from onc21:/home/Casey,onc23:/home/CaseyFlags:         vers=3,proto=tcp,sec=sys,hard,intr,llock,link,symlink,acl,
devs,rsize=32768,wsize=32768,retrans=5,timeo=600Attr cache: acregmin=3,acregmax=60,acdirmin=30,acdirmax=60Failover: noresponse=0,failover=0,remap=0,currserver=onc21

The Failover line in the above output indicates that the failover is working.

Examples of NFS Mounts

  • Mounting a directory as read-only with no set userid privileges

    mount -r -o nosuid broccoli:/usr/share/man /usr/share/man

    In this example, the NFS clients mount the /usr/share/man directory from the NFS server broccoli. The local mount point is also /usr/share/man. The directory is mounted as read-only.

    Figure 2-3 “NFS Mount of manpages” illustrates this example.

    Figure 2-3 NFS Mount of manpages

    NFS Mount of manpages
  • Mounting a Home directory

    mount -r -o nosuid broccoli:/home/broccoli /home/broccoli mount -r -o nosuid cauliflower:/home/cauliflower /home/cauliflower 

    In this example, the NFS client mounts the home directories from NFS servers broccoli and cauliflower . The nosuid option prevents programs with setuid permission from executing on the local client.

    Figure 2-4 “NFS Mount of Home Directories” illustrates this example.

    Figure 2-4 NFS Mount of Home Directories

    NFS Mount of Home Directories
  • Mounting an NFS Version 2 filesystem using the UDP Transport

    mount -o vers=2,proto=udp onc21:/var/mail /var/mail

    In this example, the NFS client mounts the /var/mail directory from the NFS server, onc21, using NFSv2 and the UDP protocol.

  • Mounting an NFS filesystem using an NFS URL

    mount nfs://onc31/Casey/mail /Casey/mail

    In this example, the NFS client mounts the /Casey/mail directory from NFS server, onc31, using the WebNFS protocol.

  • Mounting an NFS filesystem by using a public file handle

    mount -o public nfs://onc31/usr/%A0abc /Casey/Clay

    If the public option or a URL is specified, the mount command attempts to connect to the server using the public file handle. The daemons rpcbind and mountd are not contacted.

    In this example, the NFS client mounts /Casey/Clay directory by using a public file handle, and an NFS URL that has a non 7-bit ASCII escape sequence from the NFS server, onc31.

  • Mounting an NFS filesystem using native path

    mount -o public onc31:C:Casey:test1 /Casey/test

    A native path is a pathname that is interpreted according to conventions used on the native operating system of the NFS server.

    In this example, the NFS client mounts the /Casey/test directory using a native path and a public file handle.

  • Mounting a replicated set of NFS filesystems with same pathnames

    mount -r onc21,onc23,onc25:/Casey/Clay /Casey/Clay

    In this example, the NFS client mounts a single filesystem, /Casey/Clay that has been replicated to a number of servers with the same pathnames. This enables the NFS client to failover to either server onc21, onc23, or onc25 if the current server has become unavailable.

  • Mounting replicated set of NFS file systems with different pathnames

    mount -r onc21:/Casey/Clay,onc23:/Var/Clay,nfs://srv-z/Clay /Casey/Clay

    In this example, the NFS client mounts a replicated set of NFS file systems with different pathnames.

Secure Mounting of Directories

The mount command enables you to specify the security mode for each NFS mount point. This allows the NFS client to request a specific security mode. However, if the specific mode does not exist on the server, then the mount fails. Use the sec option to specify the security mode.

If sec is not specified in NFSv2, then the AUTH_SYS mode is used by default. If sec is not specified in NFSv3, then the default action is for the NFS client to query the server about the security mode to be used. The resulting security mode is negotiated between the NFS client and server. For more information on the available security modes, see
nfssec(5).

An Example for Securely Mounting a directory

In the following example, the NFS client forces the use of krb5 as the secure mode. The krb5 secure mode uses the Kerberos V5 protocol to authenticate users before granting access to the shared filesystems. In this example, the NFS server, onc21, also supports the same secure mode.

mount -F nfs -o sec=krb5 onc21:/casey/nfs /casey/nfs
NOTE: For specific configuration information, see “Secure NFS Setup with Kerberos”.

Changing the Default Mount Options

To change the default mount options, follow these steps:

  1. Modify the NFS mount options in the /etc/fstab file, or the AutoFS map, as needed. For more information on the different mount options that NFS supports, see mount_nfs(1M).

    If you changed the mount options for a directory that is currently mounted, you must unmount and remount it before the changes take effect. To unmount and remount the directory, enter the following commands:

    /usr/sbin/umount local_directory
    /usr/sbin/mount local_directory
  2. If you change the mount options in the AutoFS master map, you must restart AutoFS for the changes to take effect. For information on restarting AutoFS, see “Restarting AutoFS”.

For more information on the different caching mount options, see mount_nfs(1M).

Unmounting (Removing) a Mounted Directory

You can temporarily unmount a directory using the umount command. If you want to stop a directory from being automatically mounted upon server restart or system reboot, remove it from the /etc/fstab file.

NOTE: Before you unmount a directory, run the fuser -cu command to determine whether the directory is currently in use. The fuser command lists the process IDs and user names of all the processes who are using the mounted directory. If users are accessing the mounted directories, they must exit the directories before you unmount the directory.

To unmount a mounted directory and prevent it from being automatically mounted, follow these steps:

Automatic Unmount

  1. To check for any processes accessing the mounted directory, enter the following command:

    fuser -cu mounted_directory

  2. To kill the processes, enter the following command:

    fuser -ck local_mount_point
  3. Unmount the filesystem as follows:

    /usr/sbin/umount mounted_directory

  4. If the unmount fails, use the forcible option to unmount the filesystem:

    /usr/sbin/umount -f mounted_directory

  5. Verify whether all the directories are unmounted by entering the following command:

    mount

    The directories that you have unmounted must not be present in the list displayed.

  6. If you do not want the directory to be automatically mounted when the system is rebooted, remove the directory entry from the /etc/fstab file.

Disabling NFS Client Capability

To disable the NFS client, follow these steps:

  1. On the NFS client, enter the following command to get a list of all the mounted NFS filesystems on the client

    /usr/sbin/nfsstat -m
  2. For every NFS mounted directory listed by the nfsstat command, enter the following command to determine whether the directory is currently in use:

    /usr/sbin/fuser -cu local_mount_point

    This command lists the process IDs and user names of all processes currently using the mounted directory.

  3. To kill all processes that are using the mounted directory, enter the following command:

    /usr/sbin/fuser -ck local_mount_point
  4. To unmount all NFS mounted directories, enter the following command:

    /usr/sbin/umount -aF nfs
  5. To disable the NFS client and Autofs, edit the /etc/rc.config.d/nfsconf file on the client to set the NFS_CLIENT and AUTOFS variables to 0, as follows:

    NFS_CLIENT=0
    AUTOFS=0
    This prevents the client processes from starting up again when you reboot the client.
  6. Enter the following command to disable NFS client capability:

    /sbin/init.d/nfs.client stop

    For more information, see umount (1M), mount(1M), and fuser(1M).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2007 Hewlett-Packard Development Company, L.P.