Network File System (NFS)
NFS allows distributed file resources to appear as a single-file system to clients. Although originally
designed to run on Solaris, it has support from other versions of Unix and other operating systems.
Although NFS uses RPC, it is very often assigned the destination port 2049.
In order for clients to access a NFS server they must use the Mount protocol to gain a file handle that is
recognised by NFS. Mount connects between the local operating system and the NFS and deals with authentication and
the format of the path name etc. NFS Mount is very similar to the normal Unix Mount.
MOUNT frames could be one of the following:
- no operation Performs no operation.
- add mount entry Requests file handle for NFS.
- get all mounts Requests list of mounts for the client.
- del mount entry Requests deletion of mount entry.
- del all mounts Requests removal of mounts for client.
- get export list Requests group permissions for mounts.
- mount added Supplies file handle for use with NFS.
- give all mounts Supplies list of mounts for the client.
- mount deleted Confirms deletion of mount entry.
- mounts deleted Confirms deletion of all client mounts.
- give export list Lists group permissions for mounts.
Parameters used in Mount frames include:
- Path name - The server path name of the mounted directory displayed in double quotes.
- File handle - The 32-byte file handle used to access the mounted directory.
The following list details the types of NFS frames available:
- no operation - Null, Performs no operation.
- fetch file attribute - Request for file attributes.
- set file attribute - Attempts to set file attributes.
- get filesys root - Request for the root file handle.
- lookup filename - Requests a search for the specified file.
- read contents of link - Requests a read from a symbolic link.
- read from file - Requests a read from a file.
- write to cache - Requests a write to a cache.
- write to file - Requests a write to a file.
- create file - Requests creation of the specified file.
- delete file - Requests deletion of a file.
- rename file - Requests renaming of a file.
- generate file - Requests creation of a file link.
- generate symbolic link - Requests creation of a symbolic link.
- create directory - Requests creation of a directory.
- remove directory - Requests deletion of a directory.
- read directory - Requests a directory listing.
- read file system attributes - Requests information on the file system.
- give file attribute - Returns attributes for a file.
- file attribute set - Confirms setting of file attributes.
- filesystem root - Returns the root file handle.
- file search done - Returns result of file search.
- link read done - Returns result of a symbolic link read.
- file read done - Returns result of a file read.
- cache write done - Returns result of a cache write.
- file write done - Returns result of a file write.
- create file report - Returns file creation status.
- delete file report - Returns file deletion status.
- rename file report - Returns file renaming status.
- link file reply - Returns file linking status.
- symbolic link made - Returns symbolic link creation status.
- make dir reply - Returns directory creation status.
- remove dir reply - Returns directory deletion status.
- dir read done - Returns directory listing.
- filesystem attribute - Returns file system attributes.
NFS frames could have the following parameters:
- File handle - 32-byte file handle used to access a file.
- Number - Number of bytes read or written in file operations.
- Offset - Beginning file offset for read and write operations.
- File type - Includes the following file types:
- NON - Non-file.
- REG - Regular file.
- DIR - Directory.
- BLK - Block device.
- CHR - Character device.
- LNK - Symbolic link.
- U - Executable by specifying user ID.
- G - Executable by specifying group ID.
- S - Save as executable after use.
- R - Read permission.
- W - Write/delete permission.
- X - Execute/search permission.
- r - Read permission.
- w - Write/delete permission.
- x - Execute/search permission.
- r - Read permission.
- w - Write/delete permission.
- x - Execute/search permission
- Links - Number of hard links or filenames for the file.
- Size - File size in bytes.
- Block - Block size used for file storage.
- File system ID - Identifying code of the file system.
- File ID - Protocol ID for the file.
- Cookie pointer - Pointer to first directory listing entry requested.
- Maximum - Maximum number of entries to return for this request.
- Read device - For block and character device, reads the number of the read device.
NFS response frames can contain a completion status such as follows:
- OK - Completed with no errors.
- Ownership required - Ownership required for operation.
- File/dir not found - File or directory not found.
- Device error - System or hardware error.
- Device/addr not found - Device or I/O address error.
- Insuff access rights - Insufficient access rights.
- File/dir already exists - Duplicate file or directory.
- Device not found - Device access error.
- Not a directory - Operation only valid on directory.
- Invalid dir operation - Operation not valid on directory.
- File too large - File size too large.
- Out of disk space - File device out of space.
- Write protect violation - File system is read-only.
- Filename too long - File name too long.
- Directory not empty - Directory not empty.
- Disk quota exceeded - User disk quota exceeded.
- Invalid file handle - File handle invalid.
- Write cache was flushed - Write cache flushed to disk.
- Unknown error - Unknown error type.