Differences between version 5 and revision by previous author of NFSRoot.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 5 | Last edited on Saturday, July 12, 2003 1:54:53 pm | by DanielLawson | Revert |
Older page: | version 3 | Last edited on Sunday, May 11, 2003 3:24:43 pm | by PerryLorier | Revert |
@@ -30,8 +30,11 @@
CONFIG_LOCKD=y
You can either compile this by hand or use make-kpkg under debian to install it, but however you do it you'll need to be able to install it into the nfs root we'll create in a second.
+
+I also compiled my kernel with devfs support, and automount devfs on boot ticked.
+
!Set up the root fs
Because I'm using the 'diskless' package under debian, this bit is fairly easy.
diskless comes with a program called 'diskless-createbasetgz' which creates a base.tgz (potato-install style) from a basic system root. It uses debootstrap or similar to download the required packages
@@ -39,9 +42,9 @@
diskless-createbasetgz /tmp/nfsroot/ woody http://ftp.nz.debian.org/debian /tmp/base.tgz
This creates a new system under /tmp/nfsroot, from the specified mirror. It then tars this up into /tmp/base.tgz
-If you are using diskless, you'll also need to download a copy of diskless-image-simple. NOTE: do NOT install this on your server. Just download
it, and stop any debconf
from installing it too
. Copy the deb to /tmp (or to the same dir your base.tgz is in)
+If you are using diskless, you'll also need to download a copy of diskless-image-simple. NOTE: do NOT install this on your server. Download
it manually
from packages.debian.org
. Copy the deb to /tmp (or to the same dir your base.tgz is in)
Now, if you run diskless-newimage it will create a new diskless group image in the directory you specify. You must run this program from a directory containing base.tgz and diskless-image-simple
# cd /tmp
@@ -56,24 +59,25 @@
# diskless-newimage
Follow the instructions - the defaults are probably good enough
-This has created the basic nfsroot filesystem for you. Now you must create a newhost using this image (this allows you ot have per-host settings for hostname etc)
+This has created the basic nfsroot filesystem for you. Now you must create a newhost using this image (this allows you ot have per-host settings for hostname etc). Use:
-! Set up the kernel for your nfsroot
+ # diskless-newhost /path/to/deskless/root <ip address of host>
-If
you made a debian kernel-package, copy it
to /var/lib/
diskless/default/root/root (or wherever you put your default
image)
, then
chroot to
/var/lib/diskless/default/root, and run dpkg -i root/kernel-image.....
+NOTE: if
you want
to add things to your
diskless image first
, this is a good time to do it
+
chroot /var/lib/diskless/default/root
-You'll also need to copy
the kernel
image to /tftpboot/. Name it something useful
. I called it 'nfsroot-kernel'
+This puts you in a chroot jail inside
the diskless
image. You can use apt-get update and apt-get install
to add new packages
. EG,
I added devfsd support here.
-As we are going to boot via nfsroot
, we need
to set up a special device to use
for this
.
- mknod
/dev
/boot255 c 0 255
+Also
, if you want
to change the template files
for /etc on your diskless machines, you can do that here
. Edit /usr/lib/diskless-image/template/etc/<file> inside the chroot appropriately, before you run diskless-newhost
+Note: the templates reside in the above path *inside* the chroot, or else look in /var/lib/diskless/default/root/usr/lib/diskless-image/template
/etc
/<file>
-Will create a /dev/boot255 device we can boot from. This will also need to exist within
your diskless image:
- mkdod /var/lib/diskless/default/root/dev/boot255 c 0 255
+! Set up the kernel for
your nfsroot
-Now
, use rdev
to tell the nfsroot
-kernel to boot from that device:
- rdev
/tftpboot/nfsroot-kernel /dev/boot255
+If you made a debian kernel-package
, copy it
to /var/lib/diskless/default/root/root (or wherever you put your default image), then chroot to /var/lib/diskless/default/root, and run dpkg
-i root/
kernel-image.....
+
+You'll also need to copy the kernel image to
/tftpboot/. Name it something useful. I called it '
nfsroot-kernel'
! Set up TFTP
Make a directory for the tftp root dir. I usually use /tftpboot
Under debian, make sure you have the following entries in /etc/inetd.conf:
@@ -81,9 +85,9 @@
This tells tftp to use /tftproot as its root - all paths are now relative to this.
! Set up DHCP
-Make sure your dhcpd config file contains something like:
+Make sure your dhcpd config file contains something like (for dhcp 2.x, default in Debian Woody)
:
allow bootp;
allow booting;
@@ -110,25 +114,28 @@
default nfs
label nfs
kernel netboot-kernel
- append root=/dev/boot255
\
+ append root=/dev/nfs
\
nfsroot=10.66.1.1:/var/lib/diskless/default/root/ \
- ip=:10.66.1.1:10.66.1.1:255.255.255.::: devfs=nomount
+ ip=dhcp
+
+** IMPORTANT
: concatenate the 'append' line, and remove the \ characters
Note, that the default file is the the default configuration file for the client. PXE actually searches first of all for its IP address printed in hexadecimal, then drops a byte off, and continues looking for this until it has to give up and use the default file. This lets you add a config file for each host you boot via PXE.
This pxe config file sets the default boot option to nfs. It tells it to boot the kernel 'netboot-kernel' which it gets via tftp. It appends the specified kernel options to the kernel. These options are all, as far as I can tell, ABSOLUTELY required.
! Set up NFS
You'll need to add something like the following lines to /etc/exports
+
+ # per-host diskless exports
/var/lib/diskless/default/10.66.1.104 10.66.1.104(rw,no_root_squash)
- /home 10.66.1.0/255.255.255.0(rw,no_root_squash)
-
+ # global diskless exports
+ /home 10.66.1.0/255.255.255.0(rw,no_root_squash)
/var/lib/diskless/default/root 10.66.1.0/255.255.255.0(rw,no_root_squash)
- /usr 10.66.1.0/255.255.255.0(ro,no_root_squash)
Note that these are different from the suggested options in the diskless package. I found mounting NFS root ro caused a lot problems.
Restart your nfs server (/etc/init.d/nfs-kernel-server restart in debian) and you are away