Creating a Linux multi-os installation USB-stick

Introduction

If you, like me, are tired of burning the latest version of your favorite Linux distribution to a CD/DVD every time a new version comes out, this multi-os installation stick might solve the problem for you.

The main differences between this solution and many other USB installation sticks are:

  • It supports installation of multiple OS:s
  • It loads and boots the entire ISO file of the selected OS from the stick. Other solutions, like syslinux, requires you to open and copy files from the ISO when creating the USB stick, instead of just putting the whole ISO there instead.

What you need

  • A computer with Linux installed.
  • Linux should have GRUB2 (not GRUB/GRUB Legacy) installed. GRUB2 is required to boot ISO images directly from disk. This feature is not available on earlier versions of GRUB.
  • An USB stick
  • Minimal/Network installation images of all distributions you want to be able to install

Prepare Gentoo Host

Install the necessary packages:

Since GRUB2 is still under development, GRUB Legacy is the standard bootloader for Gentoo. To install GRUB2, follow this guide:

http://dev.gentoo.org/~scarabeus/grub-2-guide.xml

Finally, you might also want to mount iso files on your host computer. For that you need the loop driver (CONFIG_BLK_DEV_LOOP). If you configured it as a module, load it by typing:

Prepare Ubuntu Host

Install the necessary packages:

Formatting the USB stick

Plug in the USB-stick in your computer and check what device file it was assigned to:

Assuming the USB-stick was located on /dev/sdb, unmount if needed to:

Next, clear the partition table and boot sector on the disk:

Create a new VFAT partition with 512B sectors:

Use default values for size:

Change type:

Make it bootable:

Quit fdisk:

Format the disk and give it a nice label (e.g. “MultiOSInstallDisk”):

Install GRUB

Mount the device

Install GRUB:

Note: On some system, grub-install can also be named grub2-install.

Configure GRUB (copy and paste the following code into your terminal):

https://gist.github.com/3046193#file_multiosboot.sh

Note: You can edit the file /mnt/boot/grub/grub.cfg to your liking, e.g. by adding additional ISO files.

Note2: On some systems, the /mnt/boot/grub directory can also be named /mnt/boot/grub2. In that case, change the above command from

Download ISOs

Create a directory to hold the ISOs:

Download the files:

Unmount:

Reboot and enjoy

Note: It’s a bit tricky to know what parameters and options to add to an entry in grub.cfg. One way of figuring it out is to mount and look at the ISO file:

You might also be lucky and find some pointers here:

References

http://thermsnotes.blogspot.se/2011/11/grub2-loopback-multiboot-usb.html

http://www.panticz.de/MultiBootUSB/

http://en.gentoo-wiki.com/wiki/Gentoo_minimal_CD_on_USB_stick

This Post Has 5 Comments

  1. Wow. Hard core is sure nice from time to time, but Unetbootin really does the job most of the time if all you want is your ISO on a bootable USB stick (acting as HDD, not CD drive, I’ve had issues with that).
    I can’t remember the last time i actually used CD as install medium for Linux. Windows 7 however has failed me the last two times I tried (one Home and one Premium – installer looks the same …) but it did give me a nice run down memory lane – waiting for a physical medium to spin, make sound etc.

    1. Your right, UNetbootin is a nice tool for creating a bootable USB-stick from a Linux ISO file. However, the solution I presented has a some advantages:

      1. You’re not limited to the distributions supported by UNetbootin
      2. You can add more than one distribution to the USB-stick
  2. This is a cool way to use your usb. let’s say u have a decent 8 GB usb, ubuntu just gona take 2 GB of them, then with 6GB left, u can add more intro that u want like mint, backtrack 5R3 etc….

    Thank you for such an easy to follow post !

  3. just skimmed over this, will read fully when I’m home, just wanted to check if this will work for non-linux installation disks too? I’d like to stick all of my system install/repair disks on one drive so I can do call-outs with a smaller set of kit
    I have a 32GB flash drive and want to get Windows XP, Vista, 7 and 8 OEM images and the latest Gparted and Ubuntu all on it.
    A mere novelty, rather than anything massively helpful but it’ll speed up prep time (and install time, running from flash rather than disk).

  4. Thanks for the nice article buddy. Just what i was looking for, well explained.

Leave a Reply

Close Menu