When an NFS server makes one or more of its files and directories shareable, this process is called exporting. The exported files or directories are placed in the /etc/exports file. Only the exported files and directories can be accessed by an NFS client. The rules that govern communication between a client and server are as follows .
A system can act as an NFS client and server at the same time.
A server can export a file, a directory, or a complete file system.
A server can export only local file systems. File systems mounted from other servers can't be re-exported.
If a directory is exported, all of the directory tree under this directory are automatically exported.
A client can mount the exported directories or a subdirectory in the directory tree under the exported directory.
User and group IDs must match on the client and server machines for proper permissions.
The process of mounting a remote file system is complete when the following steps are completed on the NFS server and client.
The NFS server processes are started on the server machine. This is done by running the /sbin/init.d/nfs. core and /sbin/init.d/nfs.server scripts at boot time.
The shared directories are located in the /etc/exports file and are exported using the exportfs command. This command is executed at boot time by the nfs.server script. However, if you make any change to the /etc/exports file, you must use this command to re-export shared directories.
NFS client processes are running on the client machine. These are started with the help of the /sbin/init.d/nfs.core and /sbin/init.d/nfs.client scripts. Both of these scripts are invoked at run level 2.
The remote file system names and mount points are present in the /etc/fstab file.
Remote file systems can also be mounted at any time using the mount command. However, to have a remote file system mount automatically each time you reboot the system, it must be present in the /etc/fstab file.
Remote Procedure Calls (RPCs) allow procedures on the server machine to be called by programs on a client machine. All NFS communication between client and server takes place through RPCs. Since RPC (and NFS) is supported on a number of operating systems and platforms, a common data format must be used between client and server for passing data to RPCs. RPCs are made through program numbers. These program numbers are listed in the /etc/rpc file, which is displayed here.
## # pragma VERSIONID "@(#)rpc: 11R2-4" # file of rpc program name to number mappings ## rpcbind 100000 portmap sunrpc rpcbind rstatd 100001 rstat rup perfmeter rusersd 100002 rusers nfs 100003 nfsprog ypserv 100004 ypprog mountd 100005 mount showmount ypbind 100007 walld 100008 rwall shutdown yppasswdd 100009 yppasswd etherstatd 100010 etherstat rquotad 100011 rquotaprog quota rquota sprayd 100012 spray selection_svc 100015 selnsvc # pcnfsd 150001 pcnfs # # NEW SERVICES ADDED AT 6.5 # rexd 100017 rex llockmgr 100020 nlockmgr 100021 status 100024 # # SUN SUPPORTS THE FOLLOWING THAT HP DOES NOT @ release 6.5 # 3270_mapper 100013 rje_mapper 100014 database_svc 100016 alis 100018 sched 100019 x25.inr 100022 statmon 100023 bootparam 100026 ypupdated 100028 ypupdate keyserv 100029 keyserver tfsd 100037 nsed 100038 nsemntd 100039 ypxfrd 100069 nisd 100300 rpc.nisd nispasswd 100303 rpc.nispasswdd nis_cachemgr 100301 nisd_resolv 100302 rpc.nisd_resolv automountd 100099 ttdbserver 100083 cmsd 100068 dtcalendar #
Each line in this file starts with the RPC server name followed by a program number. Aliases can be listed after a program number. A line that starts with the # character is a comment.
Contact between any RPC client and server starts with the help of the portmap or rpcbind daemon. Up to version 10.20, the portmap daemon was used, which was replaced by rpcbind in the later versions. The process of establishing a connection between client and server is carried out through the following steps. When an RPC server starts, it registers its program number with portmap and the TCP or UDP ports to which it is listening.
The client contacts portmap using port number 111 on the server machine requesting the port number used by the RPC server. The client sends the RPC program number of the server program as defined in the /etc/rpc file.
The portmap returns the port number used by a server using that program number.
The client connects to the server at the port number returned by rpcbind .
The rpcbind daemon facilitates dynamic binding of program numbers to ports.
Starting with HP-UX version 10.30, NFS version 3 has been used by default. Advantages of version 3 over NFS version 2 are:
NFS version 3 supports 64-bit file offset, whereas version 2 is limited to 32 bits. A file offset of 32 bits can address a maximum file size of 2 GBytes. NFS version 3 supports a maximum file size of 128 GBytes.
Version 3 supports asynchronous I/O using kernel buffer cache management that provides data safety.
File handle size up to 64 bits can be used.
Cache management is improved.
A detailed discussion of the features supported by different NFS versions is beyond the scope of this book.
Top |