NFS Root Client Mini HOWTO
NFS Root Client Mini HOWTO
Ofer Maor
v4.1, 02 Feb, 1999
Revision History
Revision 4.1 Feb 02, 1999 Revised by: mo
The purpose of this Mini−Howto is to explain how to create client root directories on a server that is using
NFS Root mounted clients.
NFS−Root−Client Mini−HOWTO
Table of Contents
1. Copyright.........................................................................................................................................................1
1.1. Thanks...............................................................................................................................................1
2. Preface..............................................................................................................................................................2
2.1. General Overview.............................................................................................................................2
i
1. Copyright
(c) 1996 Ofer Maor (<[email protected]>)
Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective authors. Linux
HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or
electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and
encouraged; however, the author would like to be notified of any such distributions.
All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be
covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and
impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain
conditions; please contact the Linux HOWTO coordinator at the address given below.
In short, we wish to promote dissemination of this information through as many channels as possible.
However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any
plans to redistribute the HOWTOs.
If you have questions, please contact Ofer Maor (<[email protected]>), the author of this
mini−HOWTO, or Greg Hankins, the Linux HOWTO coordinator, at <[email protected]> via
email, or at +1 404 853 9989.
If you have anything to add to this Mini−Howto, please mail the author (Ofer Maor,
<[email protected]>), with the information. Any new relevant information would be appreciated.
1.1. Thanks
I would like to express my thanks to the author of the NFS−Root Howto, Andreas Kostyrca
(<[email protected]>). His Mini−Howto helped me with the first steps in creating a NFS
Root Mounted client. My Mini−Howto does not, in any way, try to replace his work, but to enhance it using
my experiences in this process.
I would also like to thank Mark Kushinsky (<[email protected]>) for polishing the english and spelling
of this Howto, thus making it much more readable.
1. Copyright 1
2. Preface
This Mini−Howto was written in order to help people who want to use NFS Root mounting to create their
client's directories. Please note that there are many ways to accomplish this, depending on your needs and
intent. If the clients are individual, and each client has its own users and administrator, it will be necessary to
make significant parts of the client dirs not shared with other clients. On the other hand, if the client is
intended for multiple users, and are all administrated by the same person (for instance, a computerclass),
make as many files as possible shareable in order to make administration more manageable. This Howto will
focus on the second issue.
• This Mini−Howto does not explain how to do the actual NFS Root mounting. Refer to the NFS−Root
Mini−Howto if you need more information about that issue.
• I based most of my client's configuration on mounts and symbolic links. A lot of those symbolic links
can be replaced by hardlinks. One should choose according to his personal preference. Putting a
hardlink over a mount and a symbolic link has its advantages, but might cause confusion. A file will
not be erased until all its hardlinks are removed. Thus, In order to prevent a case in which you
upgrade a certain file, and the hardlinks still refer to the older version, you will have to be very
careful and keep track of every link you put.
• While mounting the information from the server, two concepts can be used. The first (most common)
concept, is to mount the whole server root directory under a local directory, and then just change the
path or link the relevant directories there. I personally dislike mounting root partitions of a server on
clients. Thus, this Howto suggests a way to mount the relevant directories of the server to the relevant
places on the system.
• This Howto is based on my experience building client directories on a Slackware 3.1 based
distribution. Things may be different (especially on the rc.* files), for other users, however the
concepts should still remain the same.
2. Preface 2
3. Creating the client's root directory
3.1. Creating the directory tree
First of all, you need to create the directory structure itself. I created all the clients under
/clients/hostname and I will use it for my examples listed below. This, however, can be changed to
anything else. The first stage, then, is to create the relevant directories in the root directory. You should create
the following directories:
bin , dev , etc , home , lib , mnt , proc , sbin , server , tmp , usr , var
and any other directories you might want to have on your system.
The local, proc, and dev directories will be used separately on each machine while the rest of the
directories will be either partly or completely shared with the rest of the clients.
You should keep in mind that /dev/mouse, /dev/cdrom and /dev/modem are symbolic links to
actually devices, and therefore you should be sure that they are linked correctly to fit the client's hardware.
Since most of these binaries are by default dynamically linked, you will also need to copy a fair part of
/lib:
Hardlinking the binaries themselves, instead of copying them, should be considered. Please read my
Please notice, all of the information above assumes that the kernel has been given the network parameters
while booting up. If you plan to use rarp or bootp, you will probably need the relevant binaries for these as
well.
Generally, you will need the minimum of files that will enable you to configure the network and run rc.S up
to the point where it mounts the rest of the file system. Make sure you looked into your /etc/init and
rc.S files, making sure there are no "surprises" in any of them, which will require other files to be accessed,
before the first mount will take place. If you do, however, find such files, you can either copy them as well,
or remove the relevant parts from your init and your rc.S files.
Now, you have a choice as to what you want to separate, and what you want to share. Any directory/file that
you want to share, simply remove it from the client's var dir, and symlink it to the
/server/var/ directory. However please note that you should either symlink it to /server/var or to
../server/var but NOT to /clients/hostname/server/var as this will not work when the root
changes.
Note: this section refers to building the etc directory which is mostly shared among the
clients. If your diskless clients have separate system administrators, it's best to set up for each
client a separate etc directory.
You should add to this directory all of the non−machine−specific configuration files, for instance motd,
issue, etc. and not the clientspecific ones.(i.e. inittab or fstab)
The most important changes will be in your rc.d directory. First, you should change rc.inet1 to be
suitable for your local setup. I pass all my network parameters to the kernel through the LILO/Loadlin,
therefore I remove almost everything from rc.inet1 file. The only thing I leave there is the ifconfig and
route of the localhost. If you use rarp or bootp, you will have to build it accordingly.
Secondly, you should edit your rc.S. First, remove all the parts that are responsible for the fsck check as
fsck will occur when the server boots up. Then, you should find the line that mounts your fstab. This should
look something like:
The −t nonfs is there since normal clients first run rc.S and only later on use rc.inet1 to configure the
Ethernet. As this will cause no NFS partitions to be mounted this line should be deleted. Therefore, change it
to mount −av. If you need to run rarp/bootp to configure your network, do it in rc.S (or call the appropriate
script from rc.S), before the mount, and make sure your physical bin and sbin directories have the
necessary files available.
After the mount −av is performed, you will have a working file system. Build a general fstab, so that you can
later copy it to each client. Your fstab should look something like this:
Table 1. fstab
Please notice, that the keyword default might not work on all versions of mount. You might change it to
rw or ro or remove all of the default 1 1 part.
Table 2. /etc/exports
/clients/hostname hostname.domainname(rw,no_root_squash)
/clients/etc hostname.domainname(ro,no_root_squash)
/clients/var hostname.domainname(ro,no_root_squash)
/usr hostname.domainname(ro,no_root_squash)
/sbin hostname.domainname(ro,no_root_squash)
/bin hostname.domainname(ro,no_root_squash)
/lib hostname.domainname(ro,no_root_squash)
/home hostname.domainname(rw,no_root_squash)
Other than the first line, which should be separate for each host, the rest of the lines can be replaced with a
hostmask to fit all your hosts (like pc*.domain − keep in mind though, that * will substitue only strings
without a dot in them). I suggest that you make most of the directories read only, but this is up to you. The
no_root_squash will make sure root users on the clients have actual root permissions on the nfsd as well.
Check out man exports(5). If you want users to be able to run passwd from the clients also, make sure the
/etc has rw and not ro permissions. However, this is not advisable.
Please note another thing concerning the rc.S file. In Slackware, by default, it creates a new
/etc/issue and /etc/motd every time it runs. This function MUST be disabled if these files are
mounted ro from the server, and I would recommend that they should be disabled in any case.
Lastly, if you want to have the same userbase on the server as on the clients, you should choose between 1),
using NIS (Yellow Pages − check the yp−howto), and then each client will have a separate
/etc/passwd and /etc/group as it receives it from the NIS server. 2) In most cases, a simple symbolic
link will suffice. Therefore, you will need to either hardlink /clients/etc/passwd to /etc/passwd,
or if you prefer a symlink, link /etc/passwd to /clients/etc/passwd (and not the other way
around, since the clients do not mount the server's etc directory). Do the same for /etc/group.
resolv.conf
hosts
inittab
rc.d/rc.S
fstab
Since these 5 files can be identical on all clients, you can simply hardlink them or copy them again. However,
with the rc.S and fstab file it is advised to keep a separate copy for each client. You will also need a
separate etc/HOSTNAME for each client. I personally recommend having all of the rc.d files separate for
each client, as configuration and hardware might vary from one to another.
For each client, add to the fstab the proper swap line:
Table 3. fstab
The rest of the /etc files of the client, you can either hardlink to the /clients/etc/* files, or symlink
them to the /server/etc (which is the mount point of /clients/etc/).
Make sure your machine can resolve properly, either through a named or through etc/hosts. It is not a
bad idea to keep the server's IP in the etc/hosts, instead of counting on resolving. If you will count only
on named resolving, a problem in the named will prevent your clients from booting up.
3.4. Booting Up
Now, all you have to do is to boot up your machine, cross your fingers and hope everything works as it
should :−).
3.4. Booting Up 7
4. Creating more clients
If you have followed my instructions so far this should be simple − cd to /clients/ and type:
Good Luck....