A USB stick used as a bog-standard storage device can be transformed into a host device for Linux images upon reboot in 5 easy steps.
In this HOWTO the USB stick is identified as sdX and contains a single partition sdX1. Make careful note of the drive and partition labels on your system as they can be very different. The following steps will destroy all data currently stored on the device.
Step 1: Create a FAT32 filesystem on a unmounted USB stick:
# mkfs.vfat -n multiboot /dev/sdX1
Step 2: Mount the freshly-formatted partition and create the boot and iso folders:
$ cd <mountpoint>
$ mkdir boot iso
Step 3: Install GRUB to the Master Boot Record (MBR) of the USB stick:
# grub-install --force --no-floppy --boot-directory=<mountpoint>/boot /dev/sdX
Step 4: Download the Linux ISO images you wish to make available to GRUB and place them in the newly-created iso folder on the USB stick. For example I have installed on my own device:
Step 5: Create a grub.cfg file in the boot/grub folder of the USB drive and add menu entries for the downloaded ISO images. Using my own example above I have created:
# Config for GNU GRand Unified Bootloader (GRUB)
# /boot/grub/grub.cfg
# Timeout for menu
#set timeout=30
# Default boot entry
#set default=0
# Menu Colours
set menu_color_normal=white/black
set menu_color_highlight=white/green
# Boot ISOs
menuentry "TAILS - The Amnesic Incognito Live System" {
set iso="/iso/tails-i386-0.15.iso"
loopback loop $iso
linux (loop)/live/vmlinuz boot=live config live-media=removable nopersistent noprompt quiet timezone=America/Toronto block.events_dfl_poll_msecs=1000 splash nox11autologin module=Tails findiso=$iso quiet_
initrd (loop)/live/initrd.img
}
menuentry "GParted Live CD" {
set iso="/iso/gparted-live-0.14.0-1.iso"
loopback loop $iso
linux (loop)/live/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia toram=filesystem.squashfs findiso=$iso
initrd (loop)/live/initrd.img
}
menuentry "Debian Wheezy AMD64 Installer" {
set iso="/iso/debian-installer-wheezy-amd64-mini.iso"
loopback loop $iso
linux (loop)/linux
initrd (loop)/initrd.gz
}
menuentry "Debian Wheezy i386 Installer" {
set iso="/iso/debian-installer-wheezy-i386-mini.iso"
loopback loop $iso
linux (loop)/linux
initrd (loop)/initrd.gz
}
# Starting with v4.4rc3 it is now possible to load the embedded extensions inside an iso image file.
# See http://forum.tinycorelinux.net/index.php/topic,12786.msg69982.html#msg69982
menuentry "Tiny Core" {
set iso="/iso/TinyCore-current.iso"
loopback loop $iso
linux (loop)/boot/vmlinuz cde waitusb=5 iso=/mnt/sdb1$iso
initrd (loop)/boot/core.gz
}
menuentry "Darik's Boot and Nuke (DBAN)" {
set iso="/iso/dban-2.2.7_i586.iso"
loopback loop $iso
linux (loop)/DBAN.BZI nuke="dwipe"
}
menuentry "Memtest86+" {
linux16 /boot/memtest86+-4.20.bin
}
Done!
Save your changes, reboot, select your USB stick as your boot device and GRUB will display a menu of your Linux images. Reboot again and return to using your USB stick as a regular storage device recognized by Linux, Windows, and Mac operating systems.