NFS and Automount under FreeBSD

This document explains the changes necessary to get NFS working under FreeBSD. It also is a pointer at some of the documentation (which isn't so easy to find unfortunately).

Setting up an NFS client

To set a machine up as an NFS client, you simply need to set nfs_client to YES in /etc/sysconfig. To get permissions to the NFS servers, you have to talk to whoever runs the servers, probably facilities. Ask them to add the machine (all of its network addresses) to the netgroup "dirt". The "dirt" netgroup has access to a restricted set of partitions, specifically:

buzzard:/dirt
buzzard:/playpen
omicron:/distsys1
omicron:/distsys2
omicron:/csystems2

Setting up an NFS server

To set up a machine as an NFS server, you can simply turn on the appropriate switch in /etc/sysconfig: 

nfs_server="YES"

To make the file systems available to the other machines, edit /etc/exports and add a line for the filesystem, listing the machines that you want to make it available on. When you are done, don't forget to reset the mountd daemon with a HUP signal:

kill -1 `cat /var/run/mountd.pid`

Documentation on amd

While there is a passable man page on amd, most of the good documentation is found with the info command, info amd will point you at quite a bit of information.

Automounting NFS file-systems

We wanted to have the FreeBSD machines in the lab mount NFS space the same way that the department does. That is, you go to /net/machine_name/partition and that parition is mounted. We have that working. It was pretty straight forward. Simply edit /etc/sysconfig to change it from:

# Set to appropriate flags if you want to use AMD.  The commented-out entry
# provides a reasonable default, using the sample amd.map config file from the
# /usr/src/etc directory.
amdflags="NO"
#amdflags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"

to something more like this:

# Set to appropriate flags if you want to use AMD.  The commented-out entry
# provides a reasonable default, using the sample amd.map config file from the
# /usr/src/etc directory.
#amdflags="NO"
#amdflags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"
amdflags="-a /tmp_mnt -c 1800 -k i386 -d cs.unc.edu -l syslog /net /etc/amd.map"

Automounting CD-ROMs

We're still working on this but according to information on the net it looks like this is the "right" way to handle switching CDs easily. If a CD is set up in the amd table then the CD will automatically be umounted after a timeout and then you can put in a new disc and have it mounted by doing a 'cd' to that directory.

For a single machine, the following entry in the amd.map file allows you to cd into /net/cdrom and have the cd automounted:

cdrom           type:=program;\
                mount:="/sbin/mount_cd9660 mount_cd9660 /dev/scd0a /mnt/cdrom";\
                unmount:="/sbin/umount umount /mnt/cdrom"

Note that, in this case, amd uses mount_cd9660 to mount the cdrom. mount_cd9660 requires the mount directory to physically exist before it mounts the cdrom, so make sure the /tmp_mnt/cdrom directory exists.

The cdrom can be nfs mounted from other machines by exporting /tmp_mnt/cdrom from the machine with the cdrom, and mounting this directory from the other machine. With the automounter enabled, it may be necessary to telnet to the cdrom machine and cd into /net/cdrom to make sure that the cdrom is actually mounted before the /tmp_mnt/cdrom directory is nfs mounted elsewhere.

A better solution for making a cdrom accessible to the outside world is to make sure it is not automouted by doing amq -u /net/cdrom . Then, physically mount the cdrom using mount_cd9660 /dev/scd0a /mountpoint, and export the /mountpoint directory. This ensures that the cdrom will not be automatically unmounted after the automounter's timeout period.


Other DiRT documents
Authors: Mark Parris, Jan Borgersen
Last updated: June 13, 1997