NFS (Network File System)

The Network File System is used, obviously, to share files between machines on a network. The cool part about NFS is that it's designed such that one machine can mount shares from another transparently, and treat them like local files.

A couple of things have to happen for this to take place, though. First is the appropriate services have to be running on the server machine: these are portmap(8), nfsd(8), and mountd(8). Second is the server has to explicitly “export” a filesystem tree to the client, which is accomplished via exports(5) file in /etc.

The first part of the equation is handled by installing the tcpip1.tgz package (from the N series) and letting rc.inet2 do its thing. /etc/exports is a bit more fun.

Suppose I have a directory of images on battlecat.tdn that I want to mount on ninja.tdn. On battlecat, I'll need a line in /etc/exports that looks something like this:

   /var/media/images   ninja.tdn(ro)

Then on ninja, I can simply

   # mount -t nfs battlecat.tdn:/var/media/images /mnt

to mount the images directory as /mnt locally. Unfortunately, I've forbidden myself from writing to the shared directory-- that “(ro)” bit in battlecat's /etc/exports line is an option meaning “read-only”. Any such options need to exist after the client's name, inside parentheses, in a comma-separated list. For instance:

   /var/media/images   ninja.tdn(rw,no_root_squash)

The “rw” is obviously “read-write”-- subject to user and group id mapping (see the exports(5) man page for an explanation), users on ninja are allowed to write to the shared directory. I don't like squash, so I think I'll leave it up to that man page to explain that one to you; if you plan on doing much with NFS, exports(5) will be your best friend. Might as well get comfy, right?