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.
Edit the /etc/rc.config.d/nfsconf file to enable an NFS client to be started at boot time.
Edit the /etc/fstab file to mount remote file systems at system boot time.
Create mount points for the remote file systems.
Ensure that the name of the NFS server is present in the /etc/ hosts file if NIS or DNS are not being used.
Synchronize client and server clocks to ensure that time stamps are correct on modified files.
Either reboot the system or start the NFS client and mount remote file systems manually.
Verify mounted file systems using the mount command.
Let's discuss some of these steps in more detail.
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.
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.
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.
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.
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 |
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.
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.
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 BreakStudy Break: Configuring an NFS Server and Client
|
Top |