Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Aug 1995 19:18:00 +0800 (CST)
From:      Brian Tao <taob@gate.sinica.edu.tw>
To:        "Jeffrey D. Dean " <news@jd-unix.wpafb.af.mil>
Cc:        Questions <questions@freebsd.org>
Subject:   Re: Exporting disks via NFS
Message-ID:  <Pine.BSI.3.91.950820190343.27031D-100000@aries>
In-Reply-To: <Pine.BSF.3.91.950819145619.344B-100000@jd-unix.wpafb.af.mil>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 19 Aug 1995, Jeffrey D. Dean  wrote:
> 
> 	I have never set up nfs before. I am getting a portmap not
> registered error when trying to mount_nfs to myself.

    What do you mean by that?  NFS is used to mount disks from other
machines over the network, not to mount disks local to your machine.
You do not need to call the mount_nfs command ever.  Just plain
"mount" should do.  `man mount' for more details.

> I have a funny feeling I do not have /etc/fstab set up properly. What
> other config files must be edited before I can share a directory via
> nfs? Can anyone send me an example of a working /etc/fstab. Thanx

    If you want to export a directory on your machine to be shared by
others on the network, then you need to edit the /etc/exports file.
`man 5 exports' on the file format.  For example:

/usr/local/sharedstuff	-ro		foo,bar

  ... will export the directory /usr/local/sharedstuff on your machine
to the machines foo and bar.  It is shared as a read-only filesystem,
so nobody on foo or bar (including root) will be able to modify it.
The man page goes through other options you can use.

    In order for your machine to service these mount requests, it
needs to be running /sbin/mountd.  You also need to run /sbin/nfsd
(the NFS server daemon) to allow others to read data off your exported
directories.  Of course, you must be root to do any of this.

    The /etc/sysconfig file has a couple of lines that let you specify
whether you want your machine to be an NFS client or NFS server (or
both).  Set these to YES/NO as appropriate so that the mountd/nfsd
daemons are automatically restarted the next time you reboot.

    The /etc/fstab file contains a list of filesystems to mount on
startup, including NFS ones (assuming they have already been exported
by the server).  Mine looks like this:

/dev/sd0a              /               ufs     rw 1 1
/dev/sd0s1e            /usr            ufs     rw 1 1
/dev/sd0s1b            none            swap    sw 0 0
/dev/sd0s1f            /scratch        ufs     rw 1 1
scorpio:/home/.1       /home/.1        nfs     rw,intr,soft    0 0
scorpio:/home/.2       /home/.2        nfs     rw,intr,soft    0 0

    The first four show local disks (because I reference them by their
device names in /dev/*).  The last two are NFS disks, both mounted
from a machine called "scorpio".  The filesystems are called
"/home/.1" and "/home/.2" on scorpio, and I happen to be mounting them
at the same location on my machine (you don't have to do this).  The
third column indicates they are NFS drives, and the fourth and fifth
columns specify various mount options.  The mount_nfs man page lists
all the options in gory detail.

    So... /etc/exports is for the NFS *server* to tell it which
directories to share (export), while /etc/fstab is for all machines
and may contain information on which NFS directories to mount (import).
-- 
Brian ("Though this be madness, yet there is method in't") Tao
taob@gate.sinica.edu.tw <-- work ........ play --> taob@io.org




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.91.950820190343.27031D-100000>