Skip to content

multiple boot from ISO on USB pen drive

The USB flash or pen drives these days usually have space for the contents of multiple CD’s or even DVD’s. That means it is possible to put several bootable disk images on a flash drive. Booting them is another problem. has that covered.

The key is that GRUB2 can handle booting a system in an ISO file on a USB drive. That means you can have a boot menu to select from a set of ISO images to boot from.

Another blog that describes this technique is Booting ISO images with Grub2, among other things « GeekDeck

What you do is to install GRUB2 on the USB drive and then create (or borrow) a manually crafted grub.cfg. Since you won’t be doing any grub configuration updates, your manual grub.cfg should be safe. It just needs to be done right.

A typical stanza in grub.cfg looks like:
menuentry "Ubuntu 10.10 Desktop ISO" {
loopback loop /ubuntu.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu.iso noeject noprompt splash --
initrd (loop)/casper/initrd.lz

What it is saying is that the ubuntu.iso image file on the root of the USB drive will show on the boot menu as “Ubuntu 10.10 Desktop ISO”. It is a loopback system (inside an ISO image) that uses the files specified with the options listed to boot it. If you can find those files for a distribution or bootable linux image, you can add them to your collection. has some information about how to do this.

I formatted the drive as ext2 rather than FAT32. As long as GRUB2 can read the file system, you should be OK. Another trap was that the “boot sector” needs to be big enough to hold GRUB2’s embedded code. You may need to define the data partition starting point up a bit on a USB drive. The Ubuntu Disk Utility didn’t allow sufficient room so I used gparted and told it to leave 4 MB in front of the data partition. That eliminated the warning about having to put the embedded code in the /boot/grub location.

Also note that GRUB2 uses 32 bit code so it should run on any x86 machine. You should be able to put both 32 and 64 bit distribution images on your USB drive along with clonezilla and some diagnostics so you can use just one USB drive to install whatever system you need.

{ 1 } Trackback

  1. BackTrack / Grub2 ISO Boot | February 16, 2011 at 10:53 am | Permalink

    […] grub.cfg to install such stanzas for booting multiple iso images. — see summary and links at TCL: multiple boot from ISO on USB pen drive As long as you don't run update-grub (as is often done when updating kernel software in Ubuntu) […]

Post a Comment

You must be logged in to post a comment.