2.5. Overview of NFSThe Network File System (NFS) is a distributed filesystem that allows users to mount remote filesystems as if they were local. NFS uses a client-server model, in which a server exports directories to be shared, and clients mount the directories to access the files in them. NFS eliminates the need to keep copies of files on several machines by letting the clients all share a single copy of a file on the server. NFS is an RPC-based application-level protocol. For more information on the architecture of network protocols, see Section 2.3, "Overview of TCP/IP" earlier in this chapter. 2.5.1. Administering NFSSetting up NFS clients and servers involves starting the NFS daemons, exporting filesystems from the NFS servers, and mounting them on the clients. The /etc/exports file is the NFS server configuration file; it controls which files and directories are exported and what kinds of access are allowed. Names and addresses for clients receiving services are kept in the /etc/hosts file. 2.5.2. DaemonsNFS server daemons, called nfsd daemons, run on the server and accept RPC calls from clients. NFS servers also run the mountd daemon to handle mount requests. On the client, caching and buffering are handled by biod, the block I/O daemon. The portmap daemon maps RPC program numbers to the appropriate TCP/IP port numbers. 2.5.3. Exporting FilesystemsTo set up an NFS server, first check that all the hosts that will mount your filesystem can reach your host. Next, edit the /etc/exports file to include the mount-point pathname of the filesystem to be exported. If you are running mountd, the files will be exported as the permissions in /etc/exports allow. 2.5.4. Mounting FilesystemsTo enable an NFS client, mount a remote filesystem after NFS is started, either by using the mount command or by specifying default remote filesystems in /etc/fstab. A mount request calls the server's mountd daemon, which checks the access permissions of the client and returns a pointer to a filesystem. Once a directory is mounted, it remains attached to the local filesystem until it is dismounted with the umount command or until the local system is rebooted. Usually, only a privileged user can mount filesystems with NFS. However, you can enable users to mount and unmount selected filesystems using the mount and umount commands if the user option is set in /etc/fstab. This can reduce traffic by having filesystems mounted only when needed. To enable user mounting, create an entry in /etc/fstab for each filesystem to be mounted. Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|