Boot multiple ISOs from a single USB flash drive

From ITGwiki
Jump to: navigation, search

This article outlines the procedure for booting Ubuntu and Finnix from the same USB flash drive.



Contents

Prepare the flash drive

We're going to set up our flash drive one big, bootable FAT32 volume.

Partition

sudo cfdisk -z /dev/sdb #assuming your flash drive is sdb

Press the following to create a single bootable FAT32-ready partition.

  1. n (create a new partition)
  2. Enter (Primary)
  3. Enter (maximum size in MB)
  4. b (make it bootable)
  5. t (set the type)
  6. 7 Enter (set the type to NTFS. If you're not prompted for the type yet, hit space until you are prompted.)
  7. W (capital W, write the changes)
  8. yes Enter (confirm)
  9. q (quit)

Format

sudo mkfs.msdos -n ITG /dev/sdb1 #assuming your flash drive is sdb

Add the files

First, mount the new volume. The easiest way is just to unplug, then plug in the flash drive. It should mount to /media/ITG. Now you're going to want to create some directories in there.

mkdir -p /media/ITG/{iso,itg,boot/grub}

Ubuntu

Copy your downloaded Ubuntu ISO into the iso folder. Since these directions may vary between versions of Ubuntu, we're specifically calling this ubuntu-11.04-desktop-i386.iso.

cp ~/Downloads/ubuntu-11.04-desktop-i386.iso /media/ITG/iso/

Finnix

Mount the Finnix ISO and then copy the relevant files into the finnix folder.

This assumes that you're using the Finnix 32-bit kernel and that the initrd extension is .xz, which we'll assume for the rest of the article.
sudo mount ~/Downloads/finnix*iso /mnt -oloop
cp -a /mnt/finnix /media/ITG/
cp -a /mnt/isolinux/linux /mnt/isolinux/initrd.xz /media/ITG/finnix/ 

GRUB

Configure

Paste this into a file called /media/ITG/boot/grub/grub.cfg:

set timeout=10
set default=0

menuentry "Ubuntu 11.04 Desktop i386" {
  loopback loop /iso/ubuntu-11.04-desktop-i386.iso
  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-11.04-desktop-i386.iso vga=791 noeject noprompt --
  initrd (loop)/casper/initrd.lz
}

menuentry "Finnix 101" {
  gfxpayload=1024x768x16,1024x768
  linux /finnix/linux
  initrd /finnix/initrd.xz
}

Install

sudo grub-install --force --no-floppy --root-directory=/media/ITG /dev/sdb #assuming your flash drive is /dev/sdb

Other useful stuff

Download these things and copy them into the itg folder:

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox