home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Enter 1999 June / enter_06_1999.iso / doc / HOWTO / mini / NFS-Root < prev    next >
Text File  |  1998-10-14  |  13KB  |  397 lines

  1.   NFS-Root Mini-Howto
  2.   Andreas Kostyrka, andreas@ag.or.at
  3.   V8, 8 August 1997
  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 ftp://sun-
  8.   site.unc.edu/pub/Linux/docs/HOWTO/mini/NFS-Root or on any sunsite mir-
  9.   ror NEAR YOU.
  10.   ______________________________________________________________________
  11.  
  12.   Table of Contents
  13.  
  14.  
  15.   1. Copyright
  16.  
  17.      1.1 Contributors
  18.  
  19.   2. General Overview
  20.  
  21.   3. Setup on the server
  22.  
  23.      3.1 Compiling the kernels
  24.      3.2 Creation of the root filesystem
  25.         3.2.1 Copying the filesystem
  26.         3.2.2 Changes to the root filesystem
  27.         3.2.3 Exporting the filesystem
  28.         3.2.4 RARP setup
  29.         3.2.5 BOOTP setup
  30.         3.2.6 Finding out hardware addresses
  31.  
  32.   4. Booting the workstation
  33.  
  34.      4.1 Using a boot rom
  35.      4.2 Using a raw kernel disc
  36.      4.3 Using a bootloader &
  37.      4.4 Using a bootloader without
  38.  
  39.   5. Known problems
  40.  
  41.      5.1 /sbin/init doesn't start.
  42.      5.2 /dev troubles.
  43.  
  44.   6. Other topics
  45.  
  46.  
  47.  
  48.   ______________________________________________________________________
  49.  
  50.   1.  Copyright
  51.  
  52.   (c) 1996 Andreas Kostyrka (e9207884@student.tuwien.ac.at or
  53.   andreas@ag.or.at)
  54.  
  55.   Unless otherwise stated, Linux HOWTO documents are copyrighted by
  56.   their respective authors. Linux HOWTO documents may be reproduced and
  57.   distributed in whole or in part, in any medium physical or electronic,
  58.   as long as this copyright notice is retained on all copies. Commercial
  59.   redistribution is allowed and encouraged; however, the author would
  60.   like to be notified of any such distributions.
  61.  
  62.   All translations, derivative works, or aggregate works incorporating
  63.   any Linux HOWTO documents must be covered under this copyright notice.
  64.   That is, you may not produce a derivative work from a HOWTO and impose
  65.   additional restrictions on its distribution. Exceptions to these rules
  66.   may be granted under certain conditions; please contact the Linux
  67.   HOWTO coordinator at the address given below.
  68.  
  69.   In short, we wish to promote dissemination of this information through
  70.   as many channels as possible. However, we do wish to retain copyright
  71.   on the HOWTO documents, and would like to be notified of any plans to
  72.   redistribute the HOWTOs.
  73.  
  74.   If you have questions, please contact Andreas Kostyrka
  75.   <mailto:andreas@ag.or.at>, the author of this mini-HOWTO, or Tim
  76.   Bynum, the Linux HOWTO coordinator, at <mailto:linux-
  77.   howto@sunsite.unc.edu> via email.
  78.  
  79.  
  80.   1.1.  Contributors
  81.  
  82.  
  83.   o  Avery Pennarun <apenwarr@foxnet.net> (how to boot without LILO)
  84.  
  85.   o   Ofer Maor <ofer@hadar.co.il> (providing a better mini howto about
  86.      setting up discless workstations.)
  87.  
  88.   o  Christian Leutloff <leutloff@sundancer.tng.oche.de> (providing
  89.      infos about netboot.)
  90.  
  91.  
  92.   2.  General Overview
  93.  
  94.   Generally speaking there are the following problems for the
  95.   workstation:
  96.  
  97.   o  It must find out it's own IP-address, and if needed also the rest
  98.      of the Ethernet configuration.
  99.  
  100.   o  It must know the NFS-server and the mount path to it's root
  101.      filesystem.
  102.  
  103.   The current implementation of NFSROOT in the Linux kernel (as of
  104.   1.3.7x) allows for the following ``solutions'':
  105.  
  106.   o  The IP-address may be discovered by RARP, or the full ethernet
  107.      configuration may be passed to the kernel via kernel parameters by
  108.      LILO or LOADLIN.
  109.  
  110.   o  The NFS-path to mount can be passed via kernel parameters. If this
  111.      is not done, the kernel assumes the RARP-server also as NFS-server,
  112.      and uses compiled in default for the path part. (current default
  113.      value in the kernel: /tftpboot/<IP-address of the machine>.)
  114.  
  115.   o  The client configuration may be discovered by BOOTP.
  116.  
  117.   Before starting to setup a discless enviroment, you should decide if
  118.   you will be booting via LILO or LOADLIN. The advantage of doing so is
  119.   flexibility, the disadvantage is speed. Booting a Linux kernel without
  120.   LILO is faster. This may or may not be a consideration.
  121.  
  122.  
  123.   3.  Setup on the server
  124.  
  125.   3.1.  Compiling the kernels
  126.  
  127.   RARP support in the kernel of the server will probably be a good idea.
  128.   You must have it if you will boot without kernel parameters. On the
  129.   other hand it doesn't help you, if the client isn't on the same subnet
  130.   than the server.
  131.  
  132.  
  133.   The kernel for the workstation needs the following as a minimum set
  134.   compiled in:
  135.  
  136.   o  NFS-filesystem compiled in. (It doesn't need to have ext2-support
  137.      compiled in, a module suffices.)
  138.  
  139.   o  ``Root on NFS'' must be enabled.
  140.  
  141.   o  The Ethernet driver for the network card of the workstation must be
  142.      compiled in.
  143.  
  144.   o  Depending upon your needs you may have to include RARP or BOOTBP
  145.      support for NFS-Root. (By this I mean the questions that are asked
  146.      after the NFS question in make config.)
  147.  
  148.   If the workstation will be booted without kernel parameters, you need
  149.   also to set the root device to 0:255. Do this by creating a dummy
  150.   device file with mknod /dev/nfsroot b 0 255. After having created such
  151.   a device file, you can set root device of the kernel image with rdev
  152.   <kernel-image> /dev/nfsroot.
  153.  
  154.   3.2.  Creation of the root filesystem
  155.  
  156.   3.2.1.  Copying the filesystem
  157.  
  158.    Warning: while these instruction might work for you, they are by no
  159.   means sensefull in a production enviroment. For a better way to setup
  160.   a root filesystem for the clients, see the NFS-Root-Client mini howto
  161.   by Ofer Maor <ofer@hadar.co.il>.
  162.  
  163.   After having decided where to place the root tree, create it with
  164.   (e.g.) mkdir -p <directory> and tar cClf / - | tar xpCf <directory> -.
  165.  
  166.   If you boot your kernel without LILO, then the rootdir has to be
  167.   /tftpboot/<IP-address>. If you don't like it, you can change it in the
  168.   top Makefile in the kernel sources, look for a line like: NFS_ROOT =
  169.   -DNFS_ROOT="\"/tftpboot/%s\"" If you change this, you have to
  170.   recompile the kernel.
  171.  
  172.  
  173.   3.2.2.  Changes to the root filesystem
  174.  
  175.   Now trim the unneeded files, and check the /etc/rc.d scripts. Some
  176.   important points:
  177.  
  178.   o  One important thing is eth0 setup. The workstation comes up with a,
  179.      at least partially, setup eth0. Setting up the IP-address of the
  180.      workstation to the the IP-Address of the server is not considered a
  181.      clever thing to do. (As it happened to the author on one of his
  182.      early attempts.)
  183.  
  184.   o  Another point is the /etc/fstab of the workstation. It should be
  185.      setup for nfs filesystems.
  186.  
  187.   o  WARNING: Don't confuse the server root filesystem and the
  188.      workstation root filesystem. (I've already patched up a rc.inet1 on
  189.      the server, and wondered why the workstation still didn't work.)
  190.  
  191.  
  192.   3.2.3.  Exporting the filesystem
  193.  
  194.   Export the root dir to the work station. See exports(5). You most
  195.   likely will have to restart the nfsd/mountd after this change.  Under
  196.   RedHat this can easily be done by typing /etc/rc.d/init.d/nfs stop ;
  197.   /etc/rc.d/init.d/nfs start .
  198.  
  199.   3.2.4.  RARP setup
  200.  
  201.   Setup the RARP somewhere on the net. If you boot without a nfsroot
  202.   parameter, the RARP server has to be the NFS server. Usually this will
  203.   be the NFS server. To do this, you will need to run a kernel with RARP
  204.   support.
  205.  
  206.   To do this, execute (and install it somewhere in /etc/rc.d of the
  207.   server!):
  208.  
  209.   /sbin/rarp -s <ip-addr> <hardware-addr>
  210.  
  211.   where
  212.  
  213.      ip-addr
  214.         is the IP address of the workstation, and
  215.  
  216.      hardware-addr
  217.         is the Ethernet address of the network card of the workstation.
  218.  
  219.   example: /sbin/rarp -s 131.131.90.200 00:00:c0:47:10:12
  220.  
  221.   You can also use a symbolic name instead of the IP-address, as long
  222.   the server is able to find out the IP-address. (/etc/hosts or DNS
  223.   lookups)
  224.  
  225.  
  226.   3.2.5.  BOOTP setup
  227.  
  228.   For BOOTP setup you need to edit /etc/bootptab. Please consult the
  229.   bootpd(8) and bootptab(5) man pages.
  230.  
  231.  
  232.   3.2.6.  Finding out hardware addresses
  233.  
  234.   I don't know the hardware address! How can I find it out?
  235.  
  236.   o  Boot the kernel disk you made, and watch for the line where the
  237.      network card is recognized. It usually contains 6 hex bytes, that
  238.      should be the address of the card.
  239.  
  240.   o  Boot the workstation with some OS with TCP/IP networking enabled.
  241.      Then ping the workstation from the server. Look in the ARP-cache by
  242.      executing: /sbin/arp -a
  243.  
  244.  
  245.   4.  Booting the workstation
  246.  
  247.  
  248.   4.1.  Using a boot rom
  249.  
  250.   As I have not used such a beast myself yet, I can give you only the
  251.   following tips (courtesy of Christian Leutloff
  252.   <leutloff@sundancer.tng.oche.de>):
  253.  
  254.   o  You can't use ``normal'' bootroms.
  255.  
  256.   o  There is a netboot packet by Gero Kuhlmann, that provides for
  257.      bootroms for Linux, and further information. netboot is available
  258.      from the local Linux mirror, or as a Debian package (netboot-0.4).
  259.  
  260.   o  Read the documentation coming with your boot rom carefully.
  261.  
  262.   o  You probably will have to enable the tftpd on the server, but this
  263.      depends upon your boot rom's way of loading the kernel.
  264.  
  265.   o  Any informations on bootrom vendors of these Linux variety,
  266.      mentioned above, as not everybody has access to prom burner :(
  267.      (especially in europe, as I'm located there.) welcome, I'll include
  268.      them then here.
  269.  
  270.   4.2.  Using a raw kernel disc
  271.  
  272.   If you have exported the root filesystem with the correct name for the
  273.   default naming and your NFS server is also the RARP server (which
  274.   implies that the boxes are on the same subnet.), than you can just
  275.   boot the kernel by cating it to a disc. (You have to set the root
  276.   device in the kernel to 0:255.) This assumes, that the root directory
  277.   on the server is /tftpboot/IP-Address (this value can be changed when
  278.   compiling the kernel.)
  279.  
  280.   4.3.  Using a bootloader & RARP
  281.  
  282.   Give the kernel all needed parameters when booting, and add
  283.   nfsroot=<server-ip-addr>:</path/to/mount> where server-ip-addr is the
  284.   IP-address of your NFS-server, and /path/to/mount is the path to the
  285.   root directory.
  286.  
  287.   Tips:
  288.  
  289.   o  When using LILO consider using the ``lock'' feature: Simply type in
  290.      once all the correct parameters and add ``lock''. Next time when
  291.      booting let LILO timeout.
  292.  
  293.   o  When generating a workstation specific boot disk, you can also use
  294.      the append= feature in lilo.conf.
  295.  
  296.   4.4.  Using a bootloader without RARP
  297.  
  298.   In addition to nfsroot give a nfsaddrs=<wst-IP>:<srv-IP>:<gw-
  299.   IP>:<netm-IP>:<hostname> commandline argument for the kernel. The
  300.   kernel will setup eth0 with the given parameters:
  301.  
  302.      wst-IP
  303.         machine's IP-Address
  304.  
  305.      srv-IP
  306.         NFS-server IP-Address
  307.  
  308.      gw-IP
  309.         gateway
  310.  
  311.      netm-IP
  312.         netmask
  313.  
  314.      hostname
  315.         machine name
  316.  
  317.   5.  Known problems
  318.  
  319.  
  320.   5.1.  /sbin/init doesn't start.
  321.  
  322.   A popular problem with /sbin/init is, that some (at least) current
  323.   distributions come with /sbin/init dynamically linked. So you have to
  324.   provide a correct /lib setup to the client. One easy thing one could
  325.   try is replacing /sbin/init (for the client) with a statically linked
  326.   ``Hello World'' program.  This way you know if it is something more
  327.   basic, or ``just'' a problem with dynamic linking.
  328.  
  329.  
  330.  
  331.   5.2.  /dev troubles.
  332.  
  333.  
  334.   If you get some garbled messages about ttys when booting, then you
  335.   should run a MAKEDEV from the client in the /dev directory. There are
  336.   rumors that this doesn't work with certain server oses which use
  337.   64-bit dev numbers, should you run into this, please mail me with
  338.   which os you have the troubles. A potential solution would be to
  339.   create a small /dev ram disc early in the boot process, and reinstall
  340.   the device nodes each time.
  341.  
  342.  
  343.   6.  Other topics
  344.  
  345.  
  346.   o  There is BOOTP client:
  347.      ftp://sunsite.unc.edu/system/Network/admin/bootpc.v045.tgz
  348.  
  349.      With initrd (which is included in Linux 2.0), it could be made to
  350.      work for diskless stations quite nicely. initrd is actually always
  351.      an advanced option for more customized setups.
  352.  
  353.  
  354.   o  For plain bootpd based boots this is actually probably not needed
  355.      as Linux 2.0 contains also the option to use BOOTP instead of RARP.
  356.      (To be more precise, you can compile both in the kernel, and the
  357.      faster response wins.)
  358.  
  359.   o  In the Documentation directory of kernel source there is a file
  360.      documenting NFS-Root systems.
  361.  
  362.   o  There is a patch floating around, that allows for swapping over
  363.      NFS. It was send to me (during a private high workload phase), but
  364.      I somehow managed to loose the mail. :(
  365.  
  366.      You can get it probably from http://www.linuxhq.com/ in the
  367.      unofficial patches section.
  368.  
  369.  
  370.   o  My PGP public key can be fetched by fingering andreas@ag.or.at.
  371.      The fingerprint is: F1 F7 43 D5 07 C4 6C 87  BF 6B 33 A2 2C EE 5A
  372.      F9.
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.