Sample Chapter from the Book

Setting Up and Administering NFS and CIFS

Objectives

 

This chapter covers the following objectives:

  • Understand NFS concepts and benefits
  • Understand NFS versions, daemons, commands, related files, and startup scripts
  • How NFS client and server interact with each other
  • Setup an NFS server and client
  • Display exported and mounted NFS resources
  • Unmount and unexport a resource
  • Monitor NFS activities
  • Basic troubleshooting
  • Understand CIFS/9000 and SAMBA
  • Configure a CIFS server on HP-UX
  • Access HP-UX exported CIFS share on Windows system
  • Access MS Windows exported share on HP-UX

27.1   Understanding Network File System (NFS)

The Network File System (NFS) is based on the client/server architecture whereby users on one system access files, directories, and file systems (called Resources)  residing on a remote system as if they exist locally on their system. The remote machine that makes its resources available to be accessed over the network is called an NFS Server and the process of making them accessible over the network is referred to as Export. The resources exported by an NFS server can then be accessed by one or more systems. These systems are called NFS Clients and the process of accessing resources is referred to as Mount.

A system can be both an NFS server and an NFS client at the same time. A resource mounted by an NFS client cannot be re-exported.

When a directory or a file system is exported, the entire directory structure beneath it (including a single file or a sub-directory) becomes available to be mounted on an NFS client.

A sub-directory or the parent directory of an exported resource cannot be exported if they exist in the same file system.

NFS uses Remote Procedure Call (RPC) to allow an NFS server and an NFS client to talk to each other. RPC provides a common “language” that both the server and the client understand. This is standardized based on the fact that both the NFS server and the client may be running two totally different operating systems. RPC uses program numbers that are defined in the /etc/rpc file.

The following data is extracted from /etc/rpc file. It shows only NFS related services including the service name and the program number it uses followed by alias names.

rpcbind         100000  portmap sunrpc rpcbind

rstatd            100001  rstat rup perfmeter

mountd         100005  mount showmount

pcnfsd          150001  pcnfs

27.1.1 Benefits

Some benefits associated with using NFS are listed below:

  • NFS supports heterogeneous operating systems including all flavors of the UNIX operating system as well as Linux and Windows.
  • Multiple client machines can access a single resource simultaneously.
  • Enables sharing common application binaries and read-only information (such as the man pages) instead of putting them on each single machine. This results in reduced overall disk storage cost and administration overhead.
  • Gives access to uniform data to groups of users.
  • Useful when many users exist on many systems with each user’s home directory located on every single machine. NFS enables you to create all user home directories on a single machine under /home, for example, and export /home. Now, whichever machine a user logs on to, his/her home directory becomes available there. A user will maintain only one single home directory and not many.

27.1.2 NFS Versions

When working with a mix of HP-UX versions newer and older than 11.0, you need to ensure that proper NFS versions are specified in the configuration. The older versions supported NFS v2 and the newer versions are at NFS v3. The additional benefits you get with the newer version are:

  • Files of size up to 128gb (64-bit) are supported as compared to 2gb (32-bit) in v2.
  • Uses TCP compared with UDP in v2.
  • Enhanced performance.
  • AutoFS is supported versus Automounter in v2. AutoFS has better features than Automounter.

27.1.3 NFS Daemons, Commands, and Related Files & Scripts

When working with NFS, several daemons are involved. These daemons are described in Table 27-1.

Daemon

Description

rpcbind

Runs on both server and client. Responsible for forwarding incoming RPC requests to the appropriate RPC daemons.

portmap

Same as rpcbind but used in versions of HP-UX prior to 11.0.

rpc.mountd

Server side daemon. Responds to client requests to mount a resource or to provide exported or mounted file system status.

biod

Runs on both server and client. Stands for Block I/O Daemon. Clients use this daemon to handle buffer cache read-ahead and write-behind.

rpc.pcnfsd

Optional server side daemon for PC-based operating systems.

nfsd

Server side daemon. Responds to client requests to access files.

rpc.statd

Runs on both server and client. A client application may request this daemon to place a lock on the file it is accessing to prevent other programs from modifying it while in use.

rpc.lockd

Runs on both server and client. Keeps an eye on the NFS client that has requested a lock on a file to make sure the client is up and running. If the client reboots unexpectedly, this daemon removes all locks placed on files by applications from that client so other NFS client applications may use them.

Table 27-1 NFS Daemons

There are many commands you will be dealing with when working with NFS. Table 27-2 describes them.

Command

Description

exportfs

Server side command. Exports resources (listed in the /etc/exports file) and displays exported resources (listed in the /etc/xtab file).

showmount

Both server and client side command. Displays which resources are exported to which clients (looks into the /etc/xtab file on NFS server). Also displays which clients have these resources mounted (looks into the /etc/rmtab file on NFS server).

mount

Client side command. Mounts a resource specified at the command line or listed in the /etc/fstab file and adds an entry to the /etc/mnttab file. Displays mounted resources listed in the /etc/mnttab file. Adds an entry to the server’s /etc/rmtab file through the rpc.mountd daemon.

mountall

Client side command. Mounts all resources listed in the /etc/fstab file and adds entries to client’s /etc/mnttab file. Adds entries to server’s /etc/rmtab file through the rpc.mountd daemon.

HP-UNIX EXAM HPO-095
Google Book Search