Create a floppy disk to force booting from USB

Q I want to load Linux on to my USB 2.0 external hard drive and use it to boot my laptop. Trouble is, my laptop is an old IBM Thinkpad, so I think I will have to use a floppy disk to force it to boot from the external drive. I'll need to create this setup on my desktop, because the CD drive doesn't work. How do I set up the floppy disk to force booting from USB? Is booting a full sized distro rather than a lightweight distro from a USB port any different to set up?

A Not all external USB hard disk enclosures are bootable: work through the following instructions to find out if yours is. Booting from a floppy and passing the boot process to a hard disk is not that different to doing the same with a pen drive. The easiest way is to install as usual, by booting from the distro CD/DVD and installing to the USB drive. When you get to the bootloader section, have it install to the MBR (Master Boot Record) of the external drive, not the internal one. Recent kernels use the SCSI library for all hard disks, so your internal disk will be /dev/sda and the external /dev/sdb. We tried this with PCLinuxOS; it has a specific option for installing to USB drives. Once you have installed in this way, the distro will boot on any PC that supports booting from USB hard drives. Otherwise, you need to create a floppy disk containing the Grub bootloader. You can get a pre-made one from http://tinyurl.com/2f62dt. Download pdlfloppy.img.gz and write it to a floppy disk with

gzip -dc pdlfloppy.img.gz | dd of=/dev/fd0

This floppy is set up to boot a Pendrivelinux installation, so edit the configuration file at /mnt/floppy/boot/grub/menu.list to match the corresponding file on the USB hard drive. For PCLinuxOS, the first menu entry looks like:

title linux
kernel (hd0,0)/boot/vmlinuz BOOT_
IMAGE=linux root=/dev/sdb1 acpi=on resume=/
ev/sdb5 splash=silent vga=788
initrd (hd0,0)/boot/initrd.img

The references to /dev/sdb are probably correct unless your BIOS makes the USB device the first in the chain (sda) when you boot from it, but the Grub partition labels all refer to the first partition on the first disk, so change these to (hd1,0). Now boot from the floppy and select your new menu entry. If you get a 'file not found' error, press C to reach the Grub console and type

find /boot/vmlinuz

This will give you the number of the partition containing your kernel, and this is what you need in the kernel line of the menu. Highlight the menu entry and press E to edit, then do the same on the kernel line. Change the path and press B to boot the changed entry. If this works, make the changes permanent in the menu.lst file. Another approach is to add this to menu.lst:

root (hd1,0)
chainloader +1

This simply runs the bootloader on your external drive - useful if the drive has multiple distros.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar