(HOWTO) NFS-root + thin-client + Slackware
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Tue Jun 21 23:27:29 UTC 2005
Here is copy of what I posted to <alt.os.linux.slackware>.
As you know I do Linux thin-client on USB key. Recently, I needed to
boot a 486 machine using floppy and mount NFS-root from server, because
it didn't have USB or harddisk. Here is short outline of what I did.
It assumes Slackware, but idea will apply to other Linux distro.
1. Compile kernel with
- IP: kernel level autoconfiguration
- IP: BOOTP support
- IP: DHCP support
- IP: RARP support
- NFS file system support
- Root file system on NFS
- your ethernet card (mine is 3c905C)
2. Make boot floppy. First, create 'lilo.conf' with
boot=/dev/fd0
compact
map=map
backup=/dev/null
image=vmlinuz
append="ip=dhcp"
root=/dev/nfs
read-write # no need to fsck
label=linux
If you don't have /dev/nfs, then make it,
mknod /dev/nfs b 0 255
Then, format/make boot floppy,
fdformat /dev/fd0u1440
mke2fs /dev/fd0
mount /dev/fd0 /mnt/floppy
cp lilo.conf vmlinuz /mnt/floppy
cd /mnt/floppy
lilo -C lilo.conf
Don't forget to unmount it.
3. Create root filesystem on the server under '/tftpboot/node200',
assuming the client name is 'node200'. This is the usual location,
but can be changed by DHCP. Essentially, it's what the client
machine see as '/' when it runs.
I copied the root fileystem that I use for my ThinFlash. But, for
you, the best way is to install fresh Linux into
/tftpboot/node200
And, edit /etc/fstab
/dev/nfs / nfs defaults 0 0
to tell the system that kernel has already mounted the root
filesystem over NFS.
4. If you have many client machines (like I do), then you need to
duplicate the root filesystem for every machine. In order to reduce
maintenance, empty out
/lib/modules
/usr
because their contents are the same for all clients and server, so
you can share (ie. NFS mount) them at runtime. My root filesystem
reduces to 24MB. To do that, add the following to /etc/fstab,
192.168.1.1:/usr /usr nfs ro 0 0
192.168.1.1:/lib/modules /lib/modules nfs ro 0 0
Change /etc/rc.d/rc.S to mount them very early. Relevant portion is
if egrep '^/dev/nfs\>' /etc/fstab > /dev/null; then
/bin/rm -f /etc/mtab* # clean start
/sbin/mount -w -o remount / # initialize new /etc/mtab
/sbin/mount -a -v -t proc
egrep '^(domain|nameserver)' /proc/net/pnp > /etc/resolv.conf
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
if [ -x /etc/rc.d/rc.portmap ]; then
/etc/rc.d/rc.portmap start
fi
/sbin/mount -a -v -t nfs # finally, mount NFS
> /etc/HOSTNAME # to prevent rc.M using it
else
# ... Skip all 'fsck' section, and /etc/mtab initialization.
fi
5. Configure /etc/dhcpd.conf on the server. Relevant portion is
option domain-name "example.net";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 192.168.1.1;
option routers 192.168.1.1; # gateway
subnet 192.168.1.0 netmask 255.255.255.0 { # -- required
# Empty 'range' means BOOTP protocol will be used.
# range 192.168.1.100 192.168.1.199;
}
use-host-decl-names on; # send back "hostname" to client
host node4 { # BOOTP assignment
hardware ethernet xx:xx:xx:xx:xx:xx; # MAC address
fixed-address 192.168.1.200;
option root-path "/tftpboot/node200";
}
And, restart 'dhcpd'.
6. Boot the client machine, using boot floppy. Enjoy!
--
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list