wtorek, lutego 01, 2011

How to boot SystemRescueCD using PXE?

OK, so i thought of using PXE to boot some OSes mainly because burning/finding new XP installation disk takes too log and it would be cool to just backup windows using nothing more than AC power cable and 100Base-T.

First thing i did was to install tftp-hpa - you NEED tftp server, and tftp-hpa had smallest number of dependencies on my gentoo box. As configuration is all self explanatory and contained in one file, i will not divulge in it. If you got any problems you can try to ask them here, but, really, better put your googles on :> (or bing all info you need)

Second thing is to setup your DHCP server to provide vital options to PXE client, mainly IP address, TFTP server addres, and main PXE file to boot from. As i have network with WRT54GL (DD-WRT on it) and i'm using DNSMASQ, i added this line to config:

Where cid is hostname of my server machine, is it's IP address and pxelinux.0 is bootloader file.

Third thing to prepare is nfs server (and/or SAMBA for windows) to mount root partition. There's also possibility of using http or tftp again, but as i already had nfs to mout some shares, i worked with it.

This is where all oh-so-easy linux configuration ends and heavy wizardry of PXE starts. As for today, i booted only SystemRescueCD - it was the easiest and there were bunch of helpful howtos on the net. Plus, it enabled me to boot with sane OS, has some nice tools (like gparted - no more evil windows partitioner program which gives me creeps even thinking about it). There's also ntpasswd and memtest86 and docache and ntfs3g and.... Well, imo it's best to use as starter.

I ended up needing to burn at least one disc with SystemRescueCD. It has PXE server integrated and ready-to-use filesystem which i copied. So i burned it, booted from it and did something like:

# On SysResc Workstation:

scp -r /tftpboot normaluser@mytftpserver:/.

# On Server, as root:

cd /files/Install/tftpboot
mkdir sysresccd
mv /home/normaluser/tftpboot/* sysresccd/
chown -R nobody:nobody sysresccd/
rmdir /home/normaluser/tftpboot

Now on to install PXE bootloader. I ended up finding it on sysresCD/isolinux/pxelinux.0 - the one from syslinux i tried didn't work. I copied it to /files/install/tftproot/ (to which from now on i'll refer as $tftproot). Next thing was to make simple PXE boot menu:
mkdir $tftproot/pxelinux.cfg

touch $tftproot/pxelinux.cfg/default

Then i fired up my favourite VI-like editor (vim) and copied menu like this:
ONTIMEOUT sysresccd


LABEL ubuntu
MENU LABEL Ubuntu boot disk
COM32 ubuntu-installer/i386/boot-screens/menu.c32
APPEND ubuntu-installer/i386/boot-screens/menu.cfg

LABEL sysresccd
MENU LABEL System Rescue CD
COM32 sysresccd/isolinux/menu.c32
APPEND sysresccd/isolinux/isolinux.cfg


Even though ubuntu part is missing (no files to boot it) it all went just fine (a little patience and it will hop into sysrescd menu).
As i used older guide (for brand new SystemRescueCD 2.0.0) i ended up tweaking $tftproot/sysresccd/isolinux/isolinux.cfg as well. Main things to remember:
  • All KERNEL lines must be updated, with paths to actual files using $tftproot as / - for me it was like this: LINUX sysresccd/rescuecd
  • Same with INITRD lines - INITRD sysresccd/initram.igz
  • All APPEND lines refering to booting normal linux (like rescuecd,rescue64,altker32,altker64) MUST contain nfsboot line (path to NFS share with sysrcd.dat file) for me: netboot= - there's no DNS at this point, so only IP address
And that's it! I hope that nothing was forgotten - just remember to start tftp-hpa and nfs services :P
Next time i'll try to start Windows XP installation from PXE on linux (nlite image is compiling now, keep your thumbs up!). If You have any ideas/better ways to do this, please share them!
During my experiments i used those sites as help in putting it together:
  • http://harkko.lattu.biz/notes/pxe-boot_system_rescue_cd.html
  • http://www.sysresccd.org/Sysresccd-manual-en_PXE_network_booting
  • http://pxe.dev.aboveaverageurl.com/index.php/Main_Page
  • http://en.wikipedia.org/wiki/Preboot_Execution_Environment

Brak komentarzy: