System Rescue USB Stick HOWTO

Our 1U rackmounted systems unfortunately do not have a cdrom drive. As a result the most obvious solution was decided, which is to boot them via a USB stick. Unfortunately there are not many (any?) rescue distros out there USB stick-ready. But with little effort you can use for this purpose any distro coming with an ISO file, and fortunately there are plenty of them.

The one choosen for our purposes is the System Rescue CD. It fits easily on a 128 MB stick and contains all important command-line utilities, without being bloated with unecessary GUI programs. Moreover, besides linux it can boot various other environments for specific purposes, like freedos (for our BIOS upgrades) and memcheck. Needless to say, most of the following steps can be easily reproduced with any other live-CD distro.

Download the ISO file, in our case systemrescuecd-x86-0.2.17.iso.

Download the latest syslinux from kernel.org and untar it. This will provide the bootloader for our USB stick.

WARNING1: syslinux unfortunately supports only FAT16, not FAT32. Because most USB sticks come preformatted in FAT32, you should probably reformat it:

# mkdosfs -F 16 /dev/sda1

Mount the ISO file via loopback.

# mount -o loop systemrescuecd-x86-0.2.17.iso /mnt/iso

Mount the USB stick and after emptying it copy all the contents from the ISO file. Assuming that the USB stick is recognized as device sda:

# mount /dev/sda1 /mnt/usb
# rm -rf /mnt/usb/*
# cp -r /mnt/iso/* /mnt/usb/
# umount /mnt/iso

Although syslinux is almost identical with isolinux (used to boot the CDs) there are some basic differences. Most important, it doesn't support subdirectories, so all files necessary for booting the stick need to be in root directory.

# mv /mnt/usb/isolinux/* /mnt/usb/
# mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg

If you also want to stop syslinux from complaining about invalid options, edit syslinux.cfg and comment out the following lines near the end:

### The following lines are not supported by syslinux
#label disk1
#        localboot 0x80
#
#label disk2
#        localboot 0x81
#
#label floppy
#        localboot 0x00
#
#label nextboot
#        localboot -1

Unmount the stick:

# umount /mnt/usb

WARNING2: Although there is no apparent reason to mess with the MBR on the stick device, in my case it proved necessary. So if you notice that the stick boots on some systems while on others it doesn't, or if you just want go safe, before doing the next step copy the MBR bundled with syslinux to the USB device.

# cat syslinux-3.11/mbr.bin > /dev/sda

Now that everything is ready on the USB stick, install the syslinux bootloader:

# syslinux-3.11/unix/syslinux /dev/sda
# sync

Reboot from the USB stick! :-)