Grub2 : GNU/Linux multiboot USB stick

Hey there.

Have you ever felt the urge to try multiple *nix distributions at once, but didn't want to consume more of those shiny plastic discs? Well I did some research and found out it is quite simple.

The idea here is to use grub2's great feature whereby it is able to mount an iso off a filesystem and boot it like it was say, a CDROM in the drive.


  • You can use fdisk.
  • You're comfortable formatting a drive using the command line.
  • You can download a .iso image
  • You can edit a text file

Let's pretend you have a system with one hard drive, and you've just plugged in a 4GB+ USB stick that you'll be erasing. Let's say you want Ubuntu 10.10 (i386), Xubuntu 8.04.1 Alternate (i386), and the newest System Rescue CD (as of this writing, 1.6.3). This is what I chose to give me a range of choices when dealing with different systems.

First, format that USB drive as a FAT32 filesystem. (Check your drive size first to make sure you don't format the wrong one).

# fdisk /dev/sdb

Delete any existing partitions and add 1 primary partition the size of the whole drive. The problem I ran into here was a GPT. That's a different type of partition table, and you wouldn't want that in this scenario. If you run into a GPT you need to get rid of, install gdisk and use expert mode to erase it first.

# mkfs.vfat -m multiboot -F32 /dev/sdb1
# mkdir /mnt/sdb1
# mount /dev/sdb1 /mnt/sdb1
# grub-install --no-floppy --root-directory=/mnt/sdb1 /dev/sdb
# mkdir /mnt/sdb1/iso

Now you have to download your iso's into that directory.

# cd /mnt/sdb1/iso
# wget
# wget
# wget

Great, now you have to create a grub.cfg for grub to know how to boot it's iso's. Not every iso is the same but they're all sort of similar. This is because they name their initrd's slightly differently. For these specific distributions, the grub.cfg file will look like the following (this is placed in /mnt/sdb1/boot/grub/grub.cfg )

menuentry "Ubuntu 10.10" {
 set isofile="/iso/ubuntu-10.10-desktop-i386.iso"
 loopback loop $isofile
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noeject noprompt --
 initrd (loop)/casper/initrd.lz
menuentry "Xubuntu 8.04.1 Alternate" {
 set isofile="/iso/xubuntu-8.04.1-alternate-i386.iso"
 loopback loop $isofile
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noeject noprompt --
 initrd (loop)/casper/initrd.lz
menuentry "Sysrcd 1.6.3" {
 set isofile="/iso/systemrescuecd-x86-1.6.3.iso"
 loopback loop $isofile
 linux (loop)/isolinux/rescuecd isoloop=systemrescue-x86-1.6.3.iso
 initrd (loop)/isolinux/initram.igz

For other distributions, do similar things, but refer to their documentation as to the proper booting parameters for such a situation.

So there ya have it, no need to fool around with syslinux and your boot records anymore! Floppies are so old.

Sorry if I made any mistakes. You can email me if you have any questions.

- shawn [at] flywheelcollective [dotcom]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.