Network File System (NFS) Chunyan Zhu 08/16/2000 1 Introduction File system is a component of OS. Organization, storage, retrieve, naming,sharing, protection... NFS is designed to be portable across different machine, OS, network architecture, and transport protocols. Three topic : NFS design principles, NFS architecture, Implementation issues. 2 NFS design principle Transparent Access: Users and applications can access remote files as if they were local. Portability: NFS is machine and operating system independent. Fast Recovery From Failure: NFS is designed to recover quickly from system failures and network problems. 3 NFS design principle Network Protocol Independence: NFS has the ability to run on multiple transport protocols instead of being restricted to just one. This means new protocol in the future will not be a problem for NFS. Performance: NFS is designed for high performance. 4 NFS architecture The NFS protocol provides the medium for communication between client and server processes over the network. Virtual file system. NFS server. NFS client. 5 NFS architecture Client Computer Server Computer UNIX Kernel UNIX Kernel Virtual File System Virtual File System User Processes UNIX File System Disks NFS Client NFS Server UNIX File System Disks 6 Virtual file system A Virtual File System (VFS) module has been added to the UNIX kernel to distinguish local and remote files. And translate the UNIXindependent file identifiers used by NFS and the internal file identifiers used in UNIX. The file identifiers used in NFS are called file handlers. ( File system identifier + i-node number of file + i-node generation number) 7 NFS server The role of the NFS server is to allow its disk file systems to be shared by other machines. The process is called exporting. To export a file system : The full pathname of the directory to be exported The client machines that will have access to the exported directory Any access restrictions 8 NFS client To access the remote file system in the server, the client needs to specify: The remote host name pathname of a directory in the remote file system The local name with which it is to be mounted 9 NFS client Client Server / (root) / (root) home export students people ann bob Local and remote file systems 10 Implementation issues Stateless server. A server should not need to maintain any protocol state information about it’s client A client need only retry a request until the server responds Caching. Temporary storage of file data in a fast access local storage called cache. Once file data is cached, client requests go directly to the cache and do not require a data transfer over the network. 11 Implementation issues The NFS client can anticipate future data requirements through a process called "read- ahead" Security model The server must check the user’s identity against the file’s access permission Sun RPC requires clients to send UNIX user ID. 12 An NFS example on Solaris Assume the server name is earth.cs.seu.edu and the client name is moon.cs.seu.edu 13 An NFS example on Solaris NFS Server Processes mountd: Mount requests are handled by the mountd daemon nsfd: Once a client’s mount request has been valid by mountd, it is allowed to request various file system operations NFS Client Process automountd: Attach a remote file system to the local file system 14 An NFS example on Solaris Exporting file system on server machine Editing file: /etc/dfs/dfstab share -F nfs -o rw=moon.cs.seu.edu /export/people Mounting file system on client machine Editing file: /etc/vfstab earth.cs.seu.edu:/export/people /home/student nfs 0 yes rw 15 Summary Client-server architecture Location and access transparency Stateless server High performance by client caching 16