Note: This description is very Debian Etch or Lenny specific. If you use another distribution, you will have to change part of it accordingly! A good help centered on Ubuntu might also be found here.

In the case of a distributed system with a separate frontend and backend, the job of optimizing the frontend becomes easier. The requirements to stability is also somewhat loosened, not forgetting the WAF, as the recordings can take place independent of the front end. This thus allow us to focus on the look and the noise. And Zalman have taken care of he look.

One way to reduce the noise on the frontend is to get rid of the harddisk. This can be done in several ways, most commonly by booting over the Ethernet. Other approaches can be to get hold of a FLASH disk. I have tried to use a USB stick as they begin to be large and cheap enough to be interresting, but also compactflash cards with an IDE adapter can be used. Today, I would not worry about the limited writecycles, as they are very large.

In my case, the relatively limited size though of the FLASH opportunities compared to the ease and backup-friendlyness of network boot made me choose the latter. The root filesystem is then mounted using NFS on the backend server. If a reasonable good SATA2 disk system is used here on a not-too-loaded server, this is not slower than a local standard disk!

Network boot requires the network adapter to be able to search for a network boot image, load it and execute it. Virtually all network adapters are able to do this, but most stand-alone network adapter cards requires a boot ROM with the firmware, and this may not be easily available. On the contrary, most motherboards with build-in network adapter has this as they are already equipped with a FLASH (for the BIOS). This is thereby strongly recommended to use such one.

In the old days, the BOOTP protocol was used, but now the PXE, Preboot eXecution Environment is more common. This is what I use.

Setting up the frontend

The easiest way to get around the network boot is to first setup the frontend using an old harddisk! You at least need to boot up and get the network running. Setup any file shares you may need too.

Then you need to be sure that the driver for your network adapter is build into the kernel! And this most likely requires you to change the kernel setting (make menuconfig) and recompile the kernel. You may find help here and here and many other places. If you are rebuilding the kernel, first check if you have to patch the ftdi_sio also.
Further more, be sure the ROOT_NFS option is enabled ("Root file system on NFS" in the menuconfig, File systems, Network file systems). In the later kernels, you have to enable CONFIG_IP_PNP ("IP: kernel level autoconfiguration" in menuconfig, Networking support -> Networking options) before the ROOT_NFS becomes available.
In the file /mnt/nfs/dev/fstab comment out the line for the root file system - it will be inserted automatically. Also comment out the swap file line if any since you will ultimately be removing the disk where it is placed..

Try the new kernel - having the old kernel as a backup!
Then you must make a RAM image file for use with NFS. Install the initramfs-tools package if you do not have it already. Edit the /etc/initramfs-tools/initramfs.conf and change the line BOOT=local to BOOT=nfs. Create a new image file with:
update-initramfs -u -k < your kernel version >
Note: This will not boot locally anymore!

Setting up the server

You need the packages:
  • dhcp3-server, a DHCP server to give the frontend a fixed IP address and to implement the PXE service initiation
  • atftpd, a good small tftp server to serve the kernel at boot time
  • nfs-kernel-server to serve the root file system. The nfs-user-server is not recommended as it seems less suited to network boot.
  • syslinux contains the Linux implementation of the PXE protocol pxelinux.0

    DHCP

    Set up the DHCP server in general - this probably means disabling the server you are currently using, typically in you router. A minimum configuration for the ISC DHCPd server v.3 could be:

    Note the hardware section defining the frontend - you need to put in the actual MAC address of your network adapter. When the DHCP server is running, it will log them to the /var/log/syslog when DCHP leases is handed out, so you can get them from there.

    atftp

    The tftp server is started using xinet. The entire configuration is done as command line arguments and is therefore in the xinet configuration file, which is /etc/xinet.d/tftp at my system. I use the configuration:

    If you use inetd, you need to change its configuration instead.

    You should also create the /tftpboot directory if it is not created by the package installer.

    nfs-server

    Create a directory for the frontend root system. You need to create an entry in the file /dev/exports for the frontend root system like: /usr/nfs/Myth 192.168.1.10(rw,no_root_squash,no_subtree_check,sync) assuming the frontend has IP address 192.168.1.10 and the frontend root file system is located in /usr/nfs/Myth at the backend.

    The frontent root file system

    Start all the servers etc above and verify they are running (e.g. ps -e). check the logs if not.

    On the frontend mount the to-be root file system like:
    mkdir /mnt/nfs
    mount 192.168.1.2 /mnt/nfs
    Now copy the entire filesystem (excluding the virtual directories /mnt, /proc, /sys and .. ) to /mnt/nfs. I recomment using Midnight Commander, mc. It is a Linux version of the old Norton Commander. Get it with apt-get install mc.

    The firewall

    If you use a firewallon the backend (and you shoudl!), you need to open the ports for this. At least you need to open the ports:
  • dhcp: UDP port 67 and 68
  • tftp: UDP port 69

    The nfs ports are a bit tricky, as they are assigned to free, high port numbers at the server startup time. I use a script such as this to dynamically open the ports needed:
    If you do not use iptables you must modify it accordingly. You then have to run the script whenever the nfs-server or the networking/firewall are (re)started. Place a call to it in the /dev/init.d/nfs-kernel-server and the /dev/init.d/networking.

    If you use tcp-wrappers, you also may need a line in the /dev/hosts.allow: atftpd: ALL
    in-tfptd: ALL

    Putting it together

    Setup the tftp boot

    In the tftpboot place the pxelinux.0 that was installed with syslinux. You do not have to run the PXE server, as DHCPd3 takes care of the protocol startup. The reference to the pxelinux.0 in the DCHP configuration is enough.
    Also copy the Linux kernel and the RAM disk image of the frontend , e.g. vmlinuz-2.6.21 and initrd.img-2.6.21 in my case, to the tftpboot directory on the backend.

    Create the directory /tftpboot/pxelinux.cfg. In here, create a file with the boot definition. Its name must be the MAC address, like 00-1d-60-56-b6-e8, or its IP address in hexadecimal, e.g. C0A8010A for 198.168.1.10. You may have both files, but the latter is recommended here as it would ease hardware (MAC address) changes. The content of teh file is a grub-like boot definition with posibilities for a menu and selection of a specific kernel to boot - even multible OS'es. Mine is simple and look like: DEFAULT linux
    LABEL linux
    KERNEL vmlinuz-2.6.21
    APPEND root=/dev/nfs initrd=initrd.img-2.6.21 nfsroot=192.168.1.2:/usr/nfs/Myth ip=dhcp rw
    Assuming that you have everything setup as in the above description.

    Note:When using kernel 2.6.22 and later together with the Attansic L1 Gigabit Ethernetcontroller, the DHCP option did not seem to work. It failed to find the root file system and/or to initialise eth0. My workaround was to force the network settings using the line: APPEND initrd=initrd.img-2.6.24 root=/dev/nfs nfsroot=192.168.2.1:/video/Myth/Work rw ip=192.168.2.10:192.168.2.1:192.168.2.1:255.255.255.0:mythtv:eth0:none Here I (as above) have the gateway and the nfs-server at the same IP, 192.168.2.1.

    Try the boot

    Setup the frontend to use network boot. This requires you to enter the BIOS setup end enable the network boot ROM and set the boot source to this - sometimes you need to save the changes to the network boot ROM before being able to select it as boot source. If something goes wrong, you still have your harddisk as a fall-back and you may then need to redo some of the above.

    But otherwise, you can take out the harddisk and you now have a diskless thin frontend with network boot!
    Note, that you may need to edit the /dev/fstab on the frontend to change the DVD to the correct device - it may change after the harddisk is removed. For an IDE device, it will typically be /dev/hda.

    A recent Ubuntu bug concerning mountall is addressed here