33.3 Configuring an NFS Client

   

The NFS and LAN/9000 subsystems must be configured in the HP-UX kernel to configure a system as an NFS client. During the configuration process, you have to start some daemons and edit the /etc/fstab file to mount remote file systems at the system boot time. The client configuration process may be completed with the following steps.

  1. Edit the /etc/rc.config.d/nfsconf file to enable an NFS client to be started at boot time.

  2. Edit the /etc/fstab file to mount remote file systems at system boot time.

  3. Create mount points for the remote file systems.

  4. Ensure that the name of the NFS server is present in the /etc/ hosts file if NIS or DNS are not being used.

  5. Synchronize client and server clocks to ensure that time stamps are correct on modified files.

  6. Either reboot the system or start the NFS client and mount remote file systems manually.

  7. Verify mounted file systems using the mount command.

Let's discuss some of these steps in more detail.

Starting an NFS Client at Boot Time

The NFS client script /sbin/init.d/nfs.client is started at run level 2 during the boot process. Before this, /sbin/init.d/nfs. core scripts get executed. These scripts get configuration parameters from the /etc/rc.config.d/nfsconf file. The following line should be present in this file to start a system as an NFS client.

 NFS_CLIENT=1 NFS_SERVER=0 NUM_NFSD=0 NUM_NFSIOD=4 PCNFS_SERVER=0 START_MOUNTD=0 

These configuration parameters are used to start NFS daemons, which will be presented in the next section of this chapter.

Creating Mount Points and Configuring /etc/fstab

To mount any local or remote file system, you need a mount point. The mount point is a directory that is used as a reference to access a mounted file system. Create separate mount points for all remote file systems. Entries of all mount points and related file systems should be present in the /etc/fstab file so that remote file systems are mounted automatically at boot time. Sample NFS mount file system entries in the /etc/fstab file are:

 myhp:/home            /home03          nfs   rw   0   0 myhp:/usr/share/man   /usr/share/man   nfs   ro   0   0 

The syntax of these entries is the same as you studied in Chapter 18 except for the following two changes.

  1. The first field in each line is changed from a file system to a combination of host name used for the NFS server followed by a colon followed by the pathname of the remote file system that exists on the NFS server.

  2. The file system type is nfs for remotely mounted file systems.

We have used a read-write option in the first line of the /etc/fstab file above and a read-only option for the second line. Table 33-2 lists options that can be used with remote file systems.

Table 33-2. Options Used for NFS File Systems in the /etc/fstab File
Option Description
rw Grants read and write access to the file system
ro Grants read-only access
fg Retry the mount operation in the foreground
suid SUID is allowed on this file system
hard Retry mount request until the server responds
intr Permits user interrupt during hard mount retry

Mounting Remote File Systems

The NFS client executes the mount -aQF nfs command during execution of the nfs.client script at startup. However, if you have recently configured an NFS client and don't want to reboot the system, use the following commands.

 /sbin/init.d/nfs.core start /sbin/init.d/nfs.client start 

If the NIS client is already running and you have made a change in the /etc/fstab file, use the following command instead of the above two.

 mount -aF nfs 

Any file system that is not listed in the /etc/fstab file can be mounted using the mount command. The following command mounts a file system /opt/apps from an NFS server myhp on a local mount point /apps .

 mount myhp:/opt/apps /apps 

You can unmount an NFS file system in the usual way using the umount command. Entries of all mounted file systems are stored in the /etc/mnttab file.

Viewing Mounted File Systems

The mount command can be used to list all mounted file systems. To view mounted file systems, use this command without any command-line argument or option.

Viewing Exported File Systems by a Server

You can list file systems exported by a particular NFS server using the showmount command. The following command lists file systems exported by server myhp .

 showmount -e myhp 

Study Break

Study Break: Configuring an NFS Server and Client

A system can be configured as an NFS client and server simultaneously . An NFS server can also mount its own exported file systems. Let's configure a host myhp as both an NFS server and client. Create the /etc/exports file with a single line in it to export the /home file system. Edit the /etc/rc.config.d/nfsconf file and set variable values as discussed earlier. Now start the NFS client and server processes using scripts in the /sbin/init.d directory. These should be run in the following order.

 nfs.core nfs.client nfs.server 

Create a mount point to mount the exported directory ( /home ). Let's suppose you create directory /kaka as a mount point. Use the following command to mount the exported /home directory to this mount point.

 mount myhp:/home /kaka 

Use the mount command without any argument to verify that the directory is mounted.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net