home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / NFS_ROOT < prev    next >
Encoding:
Text File  |  1996-03-17  |  7.9 KB  |  226 lines

  1.   NFS-Root Mini-Howto
  2.   Andreas Kostyrka, andreas@medman.ag.or.at
  3.   V5, 14 March 1996
  4.  
  5.   This Mini-HOWTO tries explains how to setup a ``disc-less'' Linux
  6.   workstation, which mounts it's root filesystems via NFS.  The newest
  7.   version of this Mini-Howto can always be found in
  8.   ftp://ftp.ag.or.at/people/andreas/.
  9.  
  10.   1.  Copyright
  11.  
  12.   (c) 1996 Andreas Kostyrka (andreas@medman.ag.or.at or
  13.   andreas@ag.or.at)
  14.  
  15.   Unless otherwise stated, Linux HOWTO documents are copyrighted by
  16.   their respective authors. Linux HOWTO documents may be reproduced and
  17.   distributed in whole or in part, in any medium physical or electronic,
  18.   as long as this copyright notice is retained on all copies. Commercial
  19.   redistribution is allowed and encouraged; however, the author would
  20.   like to be notified of any such distributions.
  21.  
  22.   All translations, derivative works, or aggregate works incorporating
  23.   any Linux HOWTO documents must be covered under this copyright notice.
  24.   That is, you may not produce a derivative work from a HOWTO and impose
  25.   additional restrictions on its distribution. Exceptions to these rules
  26.   may be granted under certain conditions; please contact the Linux
  27.   HOWTO coordinator at the address given below.
  28.  
  29.   In short, we wish to promote dissemination of this information through
  30.   as many channels as possible. However, we do wish to retain copyright
  31.   on the HOWTO documents, and would like to be notified of any plans to
  32.   redistribute the HOWTOs.
  33.  
  34.   If you have questions, please contact Andreas Kostyrka
  35.   <mailto:andreas@ag.or.at>, the author of this mini-HOWTO, or Greg
  36.   Hankins, the Linux HOWTO coordinator, at
  37.   <mailto:gregh@sunsite.unc.edu> via email, or at +1 404 853 9989.
  38.  
  39.   1.1.  Contributors
  40.  
  41.   ╖  Avery Pennarun <apenwarr@foxnet.net> (how to boot without LILO)
  42.  
  43.   2.  General Overview
  44.  
  45.   Generally speaking there are the following problems for the
  46.   workstation:
  47.  
  48.   ╖  It must find out it's own IP-address, and if needed also the rest
  49.      of the Ethernet configuration.
  50.  
  51.   ╖  It must know the NFS-server and the mount path to it's root
  52.      filesystem.
  53.  
  54.   The current implementation of NFSROOT in the Linux kernel (as of
  55.   1.3.7x) allows for the following ``solutions'':
  56.  
  57.   ╖  The IP-address may be discovered by RARP, or the full ethernet
  58.      configuration may be passed to the kernel via kernel parameters by
  59.      LILO or LOADLIN.
  60.  
  61.   ╖  The NFS-path to mount can be passed via kernel parameters. If this
  62.      is not done, the kernel assumes the RARP-server also as NFS-server,
  63.      and uses compiled in default for the path part. (current default
  64.      value in the kernel: /tftpboot/<IP-address of the machine>.)
  65.  
  66.   Before starting to setup a discless enviroment, you should decide if
  67.   you will be booting via LILO or LOADLIN. The advantage of doing so is
  68.   flexibility, the disadvantage is speed. Booting a Linux kernel without
  69.   LILO is faster. This may or may not be a consideration.
  70.  
  71.   3.  Setup on the server
  72.  
  73.   3.1.  Compiling the kernels
  74.  
  75.   RARP support in the kernel of the server will probably be a good idea.
  76.   You must have it if you will boot without kernel parameters. On the
  77.   other hand it doesn't help you, if the client isn't on the same subnet
  78.   than the server.
  79.  
  80.   The kernel for the workstation needs the following as a minimum set
  81.   compiled in:
  82.  
  83.   ╖  NFS-filesystem compiled in. (It doesn't need to have ext2-support
  84.      compiled in, a module suffices.)
  85.  
  86.   ╖  ``Root on NFS'' must be enabled.
  87.  
  88.   ╖  The Ethernet driver for the network card of the workstation must be
  89.      compiled in.
  90.  
  91.   If the workstation will be booted without kernel parameters, you need
  92.   also to set the root device to 0:255. Do this by creating a dummy
  93.   device file with mknod /dev/nfsroot b 0 255. After having created such
  94.   a device file, you can set root device of the kernel image with rdev
  95.   <kernel-image> /dev/nfsroot.
  96.  
  97.   3.2.  Creation of the root filesystem
  98.  
  99.   3.2.1.  Copying the filesystem
  100.  
  101.   After having decided where to place the root tree, create it with
  102.   (e.g.) mkdir -p <directory> and tar cClf / - | tar xpCf <directory> -.
  103.  
  104.   If you boot your kernel without LILO, then the rootdir has to be
  105.   /tftpboot/<IP-address>. If you don't like it, you can change it in the
  106.   top Makefile in the kernel sources, look for a line like: NFS_ROOT =
  107.   -DNFS_ROOT=" If you change this, you have to recompile the kernel.
  108.  
  109.   3.2.2.  Changes to the root filesystem
  110.  
  111.   Now trim the unneeded files, and check the /etc/rc.d scripts. Some
  112.   important points:
  113.  
  114.   ╖  One important thing is eth0 setup. The workstation comes up with a,
  115.      at least partially, setup eth0. Setting up the IP-address of the
  116.      workstation to the the IP-Address of the server is not considered a
  117.      clever thing to do. (As it happened to the author on one of his
  118.      early attempts.)
  119.  
  120.   ╖  Another point is the /etc/fstab of the workstation. It should be
  121.      setup for nfs filesystems.
  122.  
  123.   ╖  WARNING: Don't confuse the server root filesystem and the
  124.      workstation root filesystem. (I've already patched up a rc.inet1 on
  125.      the server, and wondered why the workstation still didn't work.)
  126.  
  127.   3.2.3.  Exporting the filesystem
  128.  
  129.   Export the root dir to the work station. See exports(5). You most
  130.   likely will have to restart the nfsd/mountd after this change.
  131.  
  132.   3.2.4.  RARP setup
  133.  
  134.   Setup the RARP somewhere on the net. If you boot without a nfsroot
  135.   parameter, the RARP server has to be the NFS server. Usually this will
  136.   be the NFS server. To do this, you will need to run a kernel with RARP
  137.   support.
  138.  
  139.   To do this, execute (and install it somewhere in /etc/rc.d of the
  140.   server!):
  141.  
  142.   /sbin/rarp -s <ip-addr> <hardware-addr>
  143.  
  144.   where
  145.  
  146.      ip-addr
  147.         is the IP address of the workstation, and
  148.  
  149.      hardware-addr
  150.         is the Ethernet address of the network card of the workstation.
  151.  
  152.   example: /sbin/rarp -s 131.131.90.200 00:00:c0:47:10:12
  153.  
  154.   You can also use a symbolic name instead of the IP-address, as long
  155.   the server is able to find out the IP-address. (/etc/hosts or DNS
  156.   lookups)
  157.  
  158.   3.2.5.  Finding out hardware addresses
  159.  
  160.   I don't know the hardware address! How can I find it out?
  161.  
  162.   ╖  Boot the kernel disk you made, and watch for the line where the
  163.      network card is recognized. It usually contains 6 hex bytes, that
  164.      should be the address of the card.
  165.  
  166.   ╖  Boot the workstation with some OS with TCP/IP networking enabled.
  167.      Then ping the workstation from the server. Look in the ARP-cache by
  168.      executing: /sbin/arp -a
  169.  
  170.   4.  Booting the workstation
  171.  
  172.   4.1.  Using a raw kernel disc
  173.  
  174.   If you have exported the root filesystem with the correct name for the
  175.   default naming and your NFS server is also the RARP server (which
  176.   implies that the boxes are on the same subnet.), than you can just
  177.   boot the kernel by cating it to a disc. (You have to set the root
  178.   device in the kernel to 0:255.)
  179.  
  180.   4.2.  Using a bootloader & RARP
  181.  
  182.   Give the kernel all needed parameters when booting, and add
  183.   nfsroot=<server-ip-addr>:</path/to/mount> where server-ip-addr is the
  184.   IP-address of your NFS-server, and /path/to/mount is the path to the
  185.   root directory.
  186.  
  187.   Tips:
  188.  
  189.   ╖  When using LILO consider using the ``lock'' feature: Simply type in
  190.      once all the correct parameters and add ``lock''. Next time when
  191.      booting let LILO timeout.
  192.  
  193.   ╖  When generating a workstation specific boot disk, you can also use
  194.      the append= feature in lilo.conf.
  195.  
  196.   4.3.  Using a bootloader without RARP
  197.  
  198.   In addition to nfsroot give a nfsaddrs=<wst-IP>:<srv-IP>:<gw-
  199.   IP>:<netm-IP>:<hostname> commandline argument for the kernel. The
  200.   kernel will setup eth0 with the given parameters:
  201.  
  202.      wst-IP
  203.         machine's IP-Address
  204.  
  205.      srv-IP
  206.         NFS-server IP-Address
  207.  
  208.      gw-IP
  209.         gateway
  210.  
  211.      netm-IP
  212.         netmask
  213.  
  214.      hostname
  215.         machine name
  216.  
  217.   5.  Other topics
  218.  
  219.   ╖  There is BOOTP client:
  220.      ftp://sunsite.unc.edu/system/Network/admin/bootpc.v045.tgz
  221.  
  222.      With the new bzImage+initrd patches (which to my knowledge made it
  223.      into 1.3.73), it could be made to work for diskless stations quite
  224.      nicely.
  225.  
  226.