SDB:Network file system

Jump to: navigation, search
Network File System (NFS) is a protocol originally developed by Sun Microsystems in 1984 and defined in RFCs 1094, 1813, and 3530 (obsoletes 3010), as a distributed file system which allows a computer to access files over a network as easily as if they were on its local disks. NFS is one of many protocols built on the Open Network Computing Remote Procedure Call system (ONC RPC).

The term "network file system" is also often used as a generic term.

Install NFS kernel server

Sucessful NFS installations often include nfs-kernel-server package from openSUSE repositories. Simply install from YaST, or from command line type (as root):

zypper in nfs-kernel-server

Anyway this package will be automatically installed if you decide to use the NFS Server Configuration YaST2 module (or you would like to have it at hand). In this case you can simply install yast2-nfs-server package from YaST, or from command line type (as root):

zypper in yast2-nfs-server

Configure /etc/exports file

Editing the /etc/exports file is quite easy. Each line contains an export point and a whitespace-separated list of clients allowed to mount the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client. No whitespace is permitted between a client and its option list. Examples:

/export/this/directory   (ro)

This shares the directory read-only to ALL hosts, including those on the Internet! You may also include a * immediately before (ro).

/export/this/directory   192.168.1.0/24(rw,async)

This shares the directory read-and-write to all hosts in the 192.168.1.0 network, which subnet mask 255.255.255.0. Using async option usually improves performance, but at the cost that an unclean server restart (i.e. a crash) can cause data to be lost or corrupted.

See man exports for a greater list of options.

Versions and variations

Version 2 of the protocol originally operated entirely over UDP and was meant to keep the protocol stateless, with locking (for example) implemented outside of the core protocol.

Version 3 introduced support for using TCP as transport. While it is true several vendors had already extended NFS Version 2 to support TCP as transport, Sun Microsystems introduced TCP as a transport for NFS at the same time it introduced Version 3. Using TCP as transport made using NFS over a WAN more feasible.

Version 4, influenced by AFS, and CIFS includes performance improvements, mandates strong security, and introduces a stateful protocol. Version 4 was the first version developed with the Internet Engineering Task Force (IETF) after Sun Microsystems handed over the development of the NFS protocols.

Various side-band protocols have been added to NFS, including:

  • The byte-range advisory Network Lock Manager (NLM) protocol which was added to support System V UNIX file locking APIs.
  • The remote quota reporting (RQUOTAD) protocol to allow NFS users to view their data storage quotas on NFS servers.

WebNFS is an extension to Version 2 and Version 3 which allows NFS to be more easily integrated into Web browsers and to enable operation through firewalls.

Platforms

NFS is strongly associated with UNIX systems, though it can be used on any platform such as Macintosh, Windows and Novell NetWare operating systems. The Server Message Block (SMB also known as CIFS) and NetWare Core Protocol (NCP), similar protocols, are equivalent implementations of a network file system under other operating systems. Cross-platform compatibility makes NFS an ideal network file system implementation.

Automatically mounting NFS at boot-up

There is some widespread difficulty about automatically mounting NFS share at boot up. You MUST enable nfs daemon like this:

# chkconfig nfs

If you see off, then you must:

# chkconfig nfs on

Your /etc/fstab must include (at least):

remotehost:/path/to/export   /local/mountpoint   nfs   auto    0   0

You can also include the following options:

auto,tcp,ro,intr

See man nfs for more mount options. Also, be sure that your firewall is configured correctly, including all UDP and TCP ports. Be sure that your external router/firewall is forwarding ports correctly (if running NFS over Internet (WAN)).

See Also

External links