When an application accesses a file that resides on a remote machine, the program’s operating system invokes client software that contacts a file server on the remote machine and performs the requested operations on the file.
Unlike a file transfer, the application’s system does not retrieve or store an entire file at once; instead, it requests transfer of one small block of data at a time.
In addition to the basic mechanisms for reading file protections, and translate information among the presentations used on various computers.
Because a remote file access service connects two machines, it must handle differences in the way the client and server systems name files, denote paths through directories, and store information about files.
The files access software must accommodate differences and writing files, a file access service must provide ways to create and destroy files, peruse directories, authenticates requests, honor in the semantics interpretation of file operations.
An NFS file server runs on a machine (which has large disks) that has a local file system.
An NFS client runs on an arbitrary machine and access the files on machines that run NFS servers.
When an application program calls open to obtain access to a file, the OS uses the syntax of the path name to choose between local and remote file access procedures.
If the path refers to a local file, the system uses the computer’s standard file system software to access the file; If the path refers to a remote file, the system uses NFS client software to access the remote file.
When an application opens a remote file, it receive an integer descriptor for the file exactly as it would for a local file.
Internal information associated with the descriptor specifies that the file is a remote file accessible through NFS.
Whenever an application performs an operation on a file descriptor, the system checks to see whether the descriptor refers to a local or a remote file. If local, the OS handles the operation as usual, else, the OS calls NFS client translates the operation into an equivalent NFS operation and places a RPC call to the server.
The path name syntax used by the remote file system may differ from that of the client machine; e.g. NFS client code on Windows 95 (uses blackslash () as a separator character), while NFS server code on UNIX (uses slash (/) as a separator character).
To keep applications on client machines independent of file locations and server computer systems, NFS requires that only clients interpret full path names.
A client traces a path through the server’s hierarchy by sending the server one component at a time and receiving information about the file or directory it names.
For example, look up path name /a/b/c on a server, it begins by obtaining information about the server’s root directory, then look up name a in that directory, then look up name b in that directory a, then look up name c in b.
When managers install NFS client code in UNIX, they use the file system mount facility to integrate remote directories into UNIX’s hierarchical directory system.
The manager creates an empty directory in the existing system, and then mounts an NFS remote file system on it. Whenever an application program calls open, the system parses the path name one component at a time.
It looks up each component in a directory and finds the next directory to search.
If the path specified in a call to open includes an NFS-mounted directory, the system will eventually encounter the remote mount point and pass control to the NFS client code.
The NFS client finishes opening the file by continuing to parse and look up components of the path.
Because the remaining directories in the path reside on a remote machine, the NFS client code look up each component by contacting the appropriate NFS server and obtain handle for the remote file for subsequent read and write operations.
The client use the position identifier in the next request to specify which entries it has already received and which it still needs, i.e. it steps through the directory by making repeated that each specify the position identifier returned in the previous request.
NFS calls its directory position identifier a magic cookie , implying that the client does not interpret the identifier, nor can it fabricate an identifier itself.
Only a server can create a magic cookie and a client can only use a magic cookie that has been supplied by a server.