diskless PLD – part 1
Marzec 24th, 2008„disks are cheap”
They are, but nevertheless for some reasons – like saving few watts of energy, or just for pure fun – one may want to create a diskless workstation.
One of our customers (who deserves a separate entry) runs a medium sized grocery shop. Recently we had to replace one of the computers that for that last few years served as terminal at the cash desk. We decided to put a diskless workstation there – after all, if server goes down, we are in big trouble anyway, and a workstation that can’t boot would be the least of our problems.
Not being an experienced PXE user, I decided to write a small tutorial for those who would like to play a bit with diskless systems. I will provide you with a short howto that shows how to successfully boot PLD on a diskless computer.
In this part we will learn to boot PLD RescueCD. This has been previously described by jajcus and used by areq as a semi-official RescueCD-PXE howto (polish). I assume you have two computers – a server and a diskless client, and you know MAC address of the latter.
First we need ot install few packages:
# poldek -Qiv dhcp rlinetd tftpd-hpa syslinux
where dhcp is a DHCP server (in case you don’t have one yet), tftpd-hpa being a TFTP server and syslinux provides us with pxelinux.0 file (more on this later). If you already have an inet daemon, you may skip rlinetd. If not, you may install it, or some other inetd implementation, like xinetd.
Than we need to obtain PLD RescueCD, I downloaded 2.95 which was the most recent version as of this writing. Once you have it, either burn it and mount the cd, or just mount the iso and copy files we need :
# mkdir /mnt/iso
# mount -o loop RCDx86 _295.iso /mnt/iso
# cp /mnt/iso/rescue.cpi /var/lib/tftp
# cp /mnt/iso/boot/isolinux/vmlinuz /var/lib/tftp/rescue.vmlinuz
# chmod 644 /var/lib/tftp/rescue.{cpi,vmlinuz}
# umount /mnt/iso
Where vmlinuz is a kernel image, and rescue.cpi – an initrd – in case of RescueCD it’s more than that, but that’s ok.
From the syslinux package, we need pxelinux.0, which we also place in /var/lib/tftp:
# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftp
I believe pxelinux.0 can be best described as the network bootloader. It reads configuration from a specified TFTP server and behaves as told to. Both LILO and GRUB (or SILO in case of SPARC) need a config file to run properly. That’s no different in our case.
By default, PXELINUX looks up for several config files under the ${tftpdir}/pxelinux.cfg dir (where $tftpdir is /var/lib/tftp by default), starting from file named after the NIC GUID (shown on startup), going through file named as MAC address, through IP based configs till the file named ‘default’ and stops once it finds one. This lets you to be as flexible as you want to be – you may want to provide separate files for each workstation you have, or have one file for them all. In this tutotrial, we will try to keep things simple, and will refer to the default file.
# mkdir /var/lib/tftp/pxelinux.cfg
# touch/var/lib/tftp/pxelinux.cfg/default
Syntax of pxelinux config file is pretty simple and easy to understand, let me provide you with a complete setup:
# cat /var/lib/tftp/pxelinux.cfg/default
default rescuecd
label rescuecd
kernel rescue.vmlinuz
append initrd=rescue.cpi root=/dev/ram0
#
If I were to write it for GRUB, it would more or less like this:
# cat grub.test
default 0
title rescuecd
kernel /vmlinuz root=/dev/ram0
initrd  /rescue.cpi
#
Great! Our TFTP server is now set up. What’s left is to tell DHCP how to use all these goodies. I assume you have DHCP configured (or know how to do it), if not, please refer to e.g. official PLD documentation (polish). Â What you need to add is a group section that may look like this:
# grep -A 20 group /etc/dhcpd.conf
group {
next-server 192.168.1.2;
filename „pxelinux.0″;
host comp {hardware ethernet 00:12:34:56:78:90;
fixed-address 192.168.1.3;}
}
#
This should be pretty much self-explanatory, but to make things clear, next-server tells a client IP address of the server that stores a file we should load and boot. As one may assume filename tells dhcpd which file to load through TFTP. host {} declares a static entry for a given machine – you may want to have a fixed IP address for it – so that you can remotly log in.
Once you are done, you should restart the services:
# service dhcp restart
# service rc-inetd restart
After that you should be able to sucessfully boot form the diskless workstation. In the next part we will learn how to boot PLD ac on a diskless workstation.
Have fun.
Lipiec 9th, 2008 at 4:16 pm
tests time mashine