The quick secret to bootable USB keys

August 17, 2006

We got asked this in email recently, so I am going to throw my answer up here: the quick secret of making bootable USB keys is to know that USB keys are hard drives.

The person who asked the question described what they'd done as:

In short, I've copied the files from the isolinux directory on the installation CD to the USB drive, renamed isolinux.cfg to syslinux.cfg, erased isolinux.bin, unmounted the USB drive, and run syslinux /dev/sda1.

The one magic ingredient missing is that the USB key itself needs a boot block, just like a real hard drive does. (It does not need to be a very sophisticated boot block and boot loader, since its usual purpose is to immediately pass control to the 'real' boot stuff on a partition.)

How we got the boot block in our setup is that I just installed GRUB on the 'hard drive', configuring it to immediately start the syslinux in the single partition. There are probably easier ways, but I don't know them and I was in a hurry at the time and GRUB was handy.

The other way to deal with this, and sometimes the more convenient way, is to not use partitions on the USB key at all and simply dump stuff directly on the entire disk, treating it as a giant floppy (using /dev/sda instead of /dev/sda1). For Fedora Core, you can just dd the diskboot.img file (found in the images directory on the CDs or DVD) to the USB key's SCSI device straight.

(Disclaimer: I've only tried this with exactly one USB key on one test machine that I had handy, so I can't say that this is extensively tested, and I have a vague memory that I wound up using the partitioning approach because at some point I had problems with the non-partitioned one.)

Written on 17 August 2006.
« The fun of 32-bit bugs
Idealist versus Realist »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Aug 17 11:53:37 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.