How's this for a minimal nfsroot system:
I have no name!@box:/# du -b -s
5070848 .
I have no name!@box:/# echo $(find /) | fold -s
/ /bin /bin/bash /bin/dd /bin/mount /bin/cp /bin/ldd /bin/cat /bin/ls /bin/ps 
/bin/top /bin/strace /bin/ln /bin/chown /bin/mkdir /bin/more /bin/less 
/bin/lynx /bin/ping /bin/cut /bin/find /bin/fold /bin/du /boot /dev 
/dev/console /dev/null /dev/ram0 /dev/ram1 /dev/ram2 /dev/zero /dev/ram3 
/dev/ram4 /dev/pts /lib /lib/libncurses.so.5 /lib/libdl.so.2 /lib/libc.so.6 
/lib/ld-linux.so.2 /lib/libext2fs.so.2 /lib/libcom_err.so.2 /lib/libblkid.so.1 
/lib/libuuid.so.1 /lib/libe2p.so.2 /lib/librt.so.1 /lib/libpthread.so.0 
/lib/libproc.so.3.2.1 /lib/libz.so.1 /lib/libnss_files.so.2 
/lib/libnss_nis.so.2 /lib/libnss_dns.so.2 /lib/libnss_compat.so.2 
/lib/libresolv.so.2 /lib/libpopt.so.0 /opt /root /root/.bash_history /sbin 
/sbin/mke2fs /sbin/route /sbin/pump /sbin/ifconfig /sys /usr /usr/share 
/usr/share/terminfo /usr/share/terminfo/l /usr/share/terminfo/l/linux 
/usr/share/terminfo/x /usr/share/terminfo/x/xterm /usr/share/terminfo/r 
/usr/share/terminfo/r/rxvt /usr/share/terminfo/v /usr/share/terminfo/v/vt100 
/home /mnt /proc /tmp /var /ref /ref/etc /ref/etc/init /ref/etc/lynx.cfg 
/ref/etc/protocols /ref/etc/services /ref/var /ref/home /ref/home/user /etc 
/etc/init /etc/services /etc/lynx.cfg /etc/protocols 
I have no name!@box:/#
Don't sweat the "I have no name!" stuff, that's just because I was chrooted into the nfsroot system on the bootserver itself; you don't see that on the target boxen. So far they can only lynx around on the net, but that's a start! And I'm learning a lot building it bottom-up this way. Here's /etc/init:
#!/bin/bash
exec </dev/console >/dev/console 2>/dev/console
PATH=/bin:/sbin
ramfs() {
 dd if=/dev/zero of=/dev/ram$1 bs=1024 count=4096 &>/dev/null
 mke2fs -q /dev/ram$1 &>/dev/null
 mount -n /dev/ram$1 $2 &>/dev/null
}
echo Setting up ramdisks...
ramfs 0 /tmp
ramfs 1 /etc
ramfs 2 /var
ramfs 3 /home
mount -n -t proc proc /proc &>/dev/null
cp /proc/mounts /etc/mtab
# make sure ref has hardlinks to all necessary files
cp -a /ref/* /
mount -o rw,gid=5,mode=620 -t devpts devpts /dev/pts
# the following only works while host knows only its IP
netroot=$(echo $HOSTNAME | cut -d '.' -f 1,2,3)
cp /proc/net/pnp /etc/resolv.conf
route add default gw $netroot.1
echo Well, here you go... be aware that keyboard interrupts do NOT work...
exec /bin/bash -l
And /etc/exports:
/opt/netboot 192.168.1.0/255.255.255.0(ro,no_root_squash,insecure_locks,no_subtree_check)
And /tftpboot/pxelinux.cfg/default:
DEFAULT vmlinuz ip=dhcp root=/dev/nfs nfsroot=/opt/netboot init=/etc/init
The reason it seems I haven't progressed much since July is that I was getting those stale NFS file handles and didn't know how to solve it, so abandoned the nfsroot method at that time... it turned out, of course, that I wasn't specifying the right export options. Until my hard drive died a few days ago, I had been booting using an initrd, and mounting individual shares over NFS. Not much difference in the results, really, just another approach.
last updated 2013-01-10 20:32:12. served from tektonic.jcomeau.com