MultiBoot USB

This is a project that contains a collection of GRUB files and scripts that will allow you to create a pendrive capable of booting different ISO files.

Preparing the multiboot USB

Getting the configuration files

Using Git

If we have Git installed on the system, we can get the files directly from the repository:

git clone

After this, every time we want to update the files we do:

cd multibootusb && git pull

Without Git

If Git is not installed, we can still get the files as long as we have a basic Unix environment available:

wget -O - | tar -xzv --strip-components 1 --exclude={,docs}

Creating new USB drive

We must have the files for targets i386-pc (e.g. package grub-pc-bin in Debian/Ubuntu) and x86_64-efi (e.g. package grub-efi-amd64-bin in Debian/Ubuntu) available in the system, usually in /usr/lib/grub/.

Manually preparing the drive

Creating a bootable USB drive

Follow the instructions to create a Hybrid UEFI GPT + BIOS GPT/MBR boot from the ArchWiki.

Copying the configuration files to the USB drive

  1. Set variables to avoid errors:

     export mntusb=<mountpoint> partusb=<partition>

    Where <mountpoint> is any directory you want the partition to be mounted at (e.g. /media/usb), and <partition> is the name of the data partition (e.g. /dev/sdh3). Run dmesg to get this information.

  2. Mount the data partition:

     mount --target $mntusb $partusb
  3. Create a directory named boot to store GRUB’s configuration files and a directory named isos for the kernel/ISO files:

     mkdir -p $mntusb/boot/{grub/mbusb.d/,isos}
  4. Copy the necessary GRUB files:

     cd multibootusb && cp -rf mbusb.* $mntusb/boot/grub/
  5. Copy the provided grub.cfg:

     cp -f grub.cfg.example $mntusb/boot/grub/grub.cfg
  6. Download MEMDISK from

     wget -qO - '' | tar -xz -C $mntusb/boot/grub/ --no-same-owner --strip-components 3 'syslinux-6.03/bios/memdisk/memdisk'

Using the script

Simply run as root:

./ <device>

Where <device> is the name of the USB device (e.g. /dev/sdh). Run mount to get this information.

WARNING: This will delete all data in the device, so make sure you pick the right one.

These are the options for the script:

Script to prepare multiboot USB drive
Usage: [options] device [fs-type] [data-size]

 device                         Device to modify (e.g. /dev/sdb)
 fs-type                        Filesystem type for the data partition [ext3|ext4|vfat|ntfs]
 data-size                      Data partition size (e.g. 5G)
  -b,  --hybrid                 Create a hybrid MBR
  -c,  --clone                  Clone Git repository on the device
  -e,  --efi                    Enable EFI compatibility
  -i,  --interactive            Launch gdisk to create a hybrid MBR
  -h,  --help                   Display this message

Adding to existing USB drive

If you already have your own bootable USB drive that uses GRUB to boot, you can simply add the following lines into your custom grub.cfg:

# Load MBUSB configuration
if [ -e "$prefix/mbusb.cfg" ]; then
  source "$prefix/mbusb.cfg"

And then copy the project’s configuration files to your drive’s GRUB directory:

cd multibootusb && cp -rf mbusb.* $mntusb/boot/grub/

Get bootable files

Once you have a bootable USB drive, it only remains to copy the bootable files (ISO or kernel) to the pendrive. See the list of supported files for download links and then save them into $mntusb/boot/isos.

Testing USB drive with QEMU

To test the newly created USB drive in a virtual environment with QEMU, run:

qemu-system-x86_64 -enable-kvm -rtc base=localtime -m 2G -vga std -drive file=<device>,readonly,cache=none,format=raw,if=virtio

Where <device> is the name of the USB device (e.g. /dev/sdh). Run mount to get this information.