This page describes the process of creating a bootable USB key that has multiple ISO images on it. This is especially useful for conferences and testing. The ISOs are simply placed unaltered onto the USB stick and may be directly booted using grub's loopback support. Magic!

Issues

Requirements

1. Grub2 (version 1 does not support loopback mode)

2. USB stick (large enough to hold your *.iso files)

Automated Instructions

1. Copy the script below into a file

2. Ensure the file is executable (chmod +x <file>)

3. Insert a USB stick

4. Run it as root (sudo ./<file> <drive>)

Manual Instructions

This is the detail step by step of how to make a multiple Ubuntu install USB stick.

  1. Prepare a blank usb stick. I have two, 4G and 8G any size should do.
  2. fdisk it and make a primary partition cover all the storage.
    • Command (m for help): p
      
      Disk /dev/sdc: 4043 MB, 4043308544 bytes
      125 heads, 62 sectors/track, 1018 cylinders
      Units = cylinders of 7750 * 512 = 3968000 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x0002098b
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/sdc1               1        1018     3944719   83  Linux
  3. sudo mkfs.ext4 /dev/sdc1 (I tried vfat and ext4, all ok)
  4. sudo mount /dev/sdc1 /mnt
  5. sudo grub-install --no-floppy --root-directory=/mnt /dev/sdc
  6. sudo vi /mnt/boot/grub/grub.cfg and key-in following messages
    • menuentry "Ubuntu 10.04 Desktop i386" {
        loopback loop /iso/ubuntu-10.04-desktop-i386.iso
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-10.04-desktop-i386.iso noeject noprompt --
        initrd (loop)/casper/initrd.lz
      }
  7. sudo mkdir /mnt/iso
  8. sudo cp ubuntu-10.04-desktop-i386.iso /mnt/iso/
  9. sudo sync;sync;umount /mnt

Then you can reboot and try it out. Enjoy!

Labeling your Stick

If you are using ext4 for your base filesystem you can label the filesystem so that it will always get mounted at the same place. This is handy if you are commonly adding and removing ISO images from the stick. Simply use e2label to label the stick and it will mount in the same place:

  1. sudo e2label /dev/sdc1 multi-iso
  2. eject and reinsert the stick
  3. df
    • [...]
      /dev/sdc1              3859224   2921048    742136  80% /media/multi-iso

Automatic Rebuild

NB: If you followed the 'Automated Instructions' above, this script is created for you - just run to update (sudo <USB_STICK_MNT_POINT>/rebuild).

If you are going to add and remove ISOs on a regular basis you can add the following script to the disk as rebuild:

Then you can simply add and remove images from the USB stick iso directory and run:

  1. sudo /mnt/rebuild

Kernel/Dev/MultipleISOBootUSBKey (last edited 2014-07-23 18:00:05 by cpe-173-174-66-68)