home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / OTHER_FO / SGML / MINI / NFS_ROOT.GZ / NFS-Root.sgml
Encoding:
SGML Document  |  1996-03-18  |  8.7 KB  |  246 lines

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