What is NFS?

This chapter covers the following topics:

Introduction

Originally developed by Sun Microsystems, the Network File System (NFS) is a TCP/IP application that has since been implemented on most DOS and Unix systems. You should find the QNX implementation invaluable for transparently accessing filesystems on other operating systems that support NFS.


Note: QNX inherently supports networked filesystems. You need to use NFS only if you're accessing non-QNX NFS filesystems, or if you want to let NFS clients access your QNX namespace. For more information on native QNX filesystems, see System Architecture.

NFS lets you graft remote filesystems - or portions of them - onto your local namespace. Directories on the remote systems appear as part of your local filesystem and all the utilities you use for listing and managing files (e.g. ls, cp, mv) operate on the remote files exactly as they do on your local files.

Setting up NFS

NFS consists of a client side and a server side:


Note: The procedures used in QNX for setting up clients and servers may differ from those used in other implementations. To set up clients and servers on a non-QNX system, see the vendor's documentation and examine the initialization scripts to see how the various programs are started on that system.

In QNX, the Socket Manager (Socket) takes care of supporting NFS. Before you can use NFS client/server features, you need to start Socket and configure your interfaces.

The NFS client

An NFS client requests that a filesystem exported from an NFS server be grafted onto its local namespace. To make this request, the client uses the mount_nfs utility.

mount_nfs

Here's an example of a client NFS request:

mount_nfs sun:/home /mnt

This request can optionally be specified as:

mount sun:/home /mnt

In this example, the client requests that the /home directory on sun be mounted onto the local namespace as /mnt.

The mount_point argument to mount_nfs (in this case, /mnt) specifies where the remote filesystem will be grafted onto the requesting client's local namespace. The mount_point doesn't have to exist as a directory, but its parent must.

The NFS server

An NFS server handles requests from NFS clients that want to access filesystems as NFS mount points. For the server to work, you need to start the following programs:

  1. the Remote Procedure Call (RPC) portmapper (portmap)
  2. the NFS daemon (nfsd)
  3. the NFS mount daemon (mountd)

For clients in a PC environment that has no concept of user/password identification (e.g. DOS), you'll also need to start the pcnfsd utility. Note that such clients also require mountd to be started with the -n option.

We recommend you start the programs in the order indicated since nfsd and mountd will attempt to communicate with portmap. If you don't start portmap first - and consequently the attempt to communicate fails - nfsd and mountd will retry briefly before giving up.

The mountd daemon reads the /etc/exports file. This file lists the filesystems that can be exported and optionally specifies which clients those filesystems can be exported to. If no client is specified, any requesting client will be given access. For example, if the /etc/exports file simply contains:

/

then / could be mounted as an NFS mount point by any NFS client. For more information, see /etc/exports in the TCP/IP Utilities chapter.


Note: The QNX NFS server makes all files below a mount point accessible to the client, including those that traverse mount points. So, for example, if you have two partitions, / and /usr, and you export /, then everything below /, including /usr, becomes available to the NFS client.

/etc/nfsstart

The commands needed to start NFS are typically placed in the /etc/nfsstart file. For more information, see /etc/nfsstart in the TCP/IP Utilities chapter.