home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / linux-2.0.34 / nfsroot.txt < prev    next >
Encoding:
Text File  |  1996-05-05  |  7.6 KB  |  205 lines

  1. Mounting the root filesystem via NFS (nfsroot)
  2. ==============================================
  3.  
  4. Written 1996 by Gero Kuhlmann <gero@gkminix.han.de>
  5.  
  6.  
  7.  
  8. If you want to use a diskless system, as an X-terminal or printer
  9. server for example, you have to put your root filesystem onto a
  10. non-disk device. This can either be a ramdisk (see initrd.txt in
  11. this directory for further information) or a filesystem mounted
  12. via NFS. The following text describes on how to use NFS for the
  13. root filesystem. For the rest of this text 'client' means the
  14. diskless system, and 'server' means the NFS server.
  15.  
  16.  
  17.  
  18.  
  19. 1.) Enabling nfsroot capabilities
  20.     -----------------------------
  21.  
  22. In order to use nfsroot you have to select support for NFS during
  23. kernel configuration. Note that NFS cannot be loaded as a module
  24. in this case. The configuration script will then ask you whether
  25. you want to use nfsroot, and if yes what kind of auto configuration
  26. system you want to use. Selecting both BOOTP and RARP is safe.
  27.  
  28.  
  29.  
  30.  
  31. 2.) Kernel command line
  32.     -------------------
  33.  
  34. When the kernel has been loaded by a boot loader (either by loadlin,
  35. LILO or a network boot program) it has to be told what root fs device
  36. to use, and where to find the server and the name of the directory
  37. on the server to mount as root. This can be established by a couple
  38. of kernel command line parameters:
  39.  
  40.  
  41. root=/dev/nfs
  42.  
  43.   This is necessary to enable the pseudo-NFS-device. Note that it's not a
  44.   real device but just a synonym to tell the kernel to use NFS instead of
  45.   a real device.
  46.  
  47.  
  48. nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
  49.  
  50.   If the nfsroot parameter is NOT give on the command line, the default
  51.   "/tftpboot/%s" will be used.
  52.  
  53.   <server-ip>    Specifies the IP address of the NFS server. If this field
  54.         is not given, the default address as determined by the
  55.         nfsaddrs variable (see below) is used. One use of this
  56.         parameter is for example to allow using different servers
  57.         for RARP and NFS. Usually you can leave this blank.
  58.  
  59.   <root-dir>    Name of the directory on the server to mount as root. If
  60.         there is a "%s" token in the string, the token will be
  61.         replaced by the ASCII-representation of the client's IP
  62.         address.
  63.  
  64.   <nfs-options>    Standard NFS options. All options are separated by commas.
  65.         If the options field is not given, the following defaults
  66.         will be used:
  67.             port        = as given by server portmap daemon
  68.             rsize        = 1024
  69.             wsize        = 1024
  70.             timeo        = 7
  71.             retrans        = 3
  72.             acregmin    = 3
  73.             acregmax    = 60
  74.             acdirmin    = 30
  75.             acdirmax    = 60
  76.             flags        = hard, nointr, noposix, cto, ac
  77.  
  78.  
  79. nfsaddrs=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
  80.  
  81.   If this parameter is missing on the kernel command line, all fields are
  82.   assumed to be empty, and the below mentioned defaults apply. In general
  83.   this means that the kernel tries to configure everything using both
  84.   RARP and BOOTP (depending on what has been enabled during kernel confi-
  85.   guration, and if both what protocol answer got in first).
  86.  
  87.   <client-ip>    IP address of the client. If empty, the address will either
  88.         be determined by RARP or BOOTP. What protocol is used de-
  89.         pends on what has been enabled during kernel configuration
  90.         and on the <autoconf> parameter. If this parameter is not
  91.         empty, neither RARP nor BOOTP will be used.
  92.  
  93.   <server-ip>    IP address of the NFS server. If RARP is used to determine
  94.         the client address and this parameter is NOT empty only
  95.         replies from the specified server are accepted. To use
  96.         different RARP and NFS server, specify your RARP server
  97.         here (or leave it blank), and specify your NFS server in
  98.         the nfsroot parameter (see above). If this entry is blank
  99.         the address of the server is used which answered the RARP
  100.         or BOOTP request.
  101.  
  102.   <gw-ip>    IP address of a gateway if the server in on a different
  103.         subnet. If this entry is empty no gateway is used and the
  104.         server is assumed to be on the local network, unless a
  105.         value has been received by BOOTP.
  106.  
  107.   <netmask>    Netmask for local network interface. If this is empty,
  108.         the netmask is derived from the client IP address, un-
  109.         less a value has been received by BOOTP.
  110.  
  111.   <hostname>    Name of the client. If empty, the client IP address is
  112.         used in ASCII-notation, or the value received by BOOTP.
  113.  
  114.   <device>    Name of network device to use. If this is empty, all
  115.         devices are used for RARP requests, and the first one
  116.         found for BOOTP. For NFS the device is used on which
  117.         either RARP or BOOTP replies have been received. If
  118.         you only have one device you can safely leave this blank.
  119.  
  120.   <autoconf>    Method to use for autoconfiguration. If this is either
  121.         'rarp' or 'bootp' the specified protocol is being used.
  122.         If the value is 'both' or empty, both protocols are used
  123.         so far as they have been enabled during kernel configura-
  124.         tion. 'none' means no autoconfiguration. In this case you
  125.         have to specify all necessary values in the fields before.
  126.  
  127.   The <autoconf> parameter can appear alone as the value to the nfsaddrs
  128.   parameter (without all the ':' characters before) in which case auto-
  129.   configuration is used. However, the 'none' value is not available in
  130.   that case.
  131.  
  132.  
  133.  
  134.  
  135. 3.) Kernel loader
  136.     -------------
  137.  
  138. To get the kernel into memory different approaches can be used. They
  139. depend on what facilities are available:
  140.  
  141.  
  142. 3.1)  Writing the kernel onto a floppy using dd:
  143.     As always you can just write the kernel onto a floppy using dd,
  144.     but then it's not possible to use kernel command lines at all.
  145.     To substitute the 'root=' parameter, create a dummy device on any
  146.     linux system with major number 0 and minor number 255 using mknod:
  147.  
  148.         mknod /dev/boot255 c 0 255
  149.  
  150.     Then copy the kernel zImage file onto a floppy using dd:
  151.  
  152.         dd if=/usr/src/linux/arch/i386/boot/zImage of=/dev/fd0
  153.  
  154.     And finally use rdev to set the root device:
  155.  
  156.         rdev /dev/fd0 /dev/boot255
  157.  
  158.     You can then remove the dummy device /dev/boot255 again. There
  159.     is no real device available for it.
  160.     The other two kernel command line parameters cannot be substi-
  161.     tuted with rdev. Therefore, using this method the kernel will
  162.     by default use RARP and/or BOOTP, and if it gets an answer via
  163.     RARP will mount the directory /tftpboot/<client-ip>/ as its
  164.     root. If it got a BOOTP answer the directory name in that answer
  165.     is used.
  166.  
  167.  
  168. 3.2) Using LILO
  169.     When using LILO you can specify all necessary command line
  170.     parameters with the 'append=' command in the LILO configuration
  171.     file. However, to use the 'root=' command you also need to
  172.     set up a dummy device as described in 3.1 above. For how to use
  173.     LILO and its 'append=' command please refer to the LILO
  174.     documentation.
  175.  
  176. 3.3) Using loadlin
  177.     When you want to boot Linux from a DOS command prompt without
  178.     having a local hard disk to mount as root, you can use loadlin.
  179.     I was told that it works, but haven't used it myself yet. In
  180.     general you should be able to create a kernel command line simi-
  181.     lar to how LILO is doing it. Please refer to the loadlin docu-
  182.     mentation for further information.
  183.  
  184. 3.4) Using a bootrom
  185.     This is probably the most elegant way of booting a diskless
  186.     client. With a bootrom the kernel gets loaded using the TFTP
  187.     protocol. As far as I know no commercial bootroms already
  188.     support booting Linux over the network, but there are two
  189.     free implementations of a bootrom available on sunsite.unc.edu
  190.     and its mirrors. They are called 'netboot-nfs' and 'etherboot'.
  191.     Both contain everything you need to boot a diskless Linux client.
  192.  
  193.  
  194.  
  195.  
  196. 4.) Credits
  197.     -------
  198.  
  199.   The nfsroot code in the kernel has been written by me, Gero Kuhlmann
  200.   <gero@gkminix.han.de>, with the BOOTP code and a couple of bug fixes
  201.   contributed by Martin Mares <mj@k332.feld.cvut.cz>. In order to write
  202.   the initial version of nfsroot I would like to thank Jens-Uwe Mager
  203.   <jum@anubis.han.de> for his help.
  204.  
  205.