I have the following USB flash drive partitions:

/dev/sdb1  *      204800   8593407  8388608    4G  b W95 FAT32 
/dev/sdb2        8593408  11460607  2867200  1.4G  b W95 FAT32 
/dev/sdb3       11460608  24043519 12582912    6G  7 HPFS/NTFS/exFAT 
/dev/sdb4       24043520 120127487 96083968 45.8G  7 HPFS/NTFS

sdb1 = Lubuntux_64 with persistence.
sdb2 = androidx_86.
sdb3 = Windows10_64.
sdb4 = General Storage.
With 100 MB unallocated before sdb1.

Why is it like this? I've tried multiple multiboot softwares, but none of them worked as expected. This configuration works, but I have to manually set the boot flag on each partition that I need for booting.

The question is: How can I install grub to sdb (that detects every OS) for a menu that allows me to choose what OS to run? I'm not afraid to write stuff manually, but I don't know what to write in grub.cfg to point me to needed partitions.

  • UEFI boot or BIOS? And you cannot from grub boot installs in different boot mode than you boot grub. I prefer to do a full install, and then with grub boot ISO directly, but have not tried that with Android, so not sure if possible. If in same boot mode, you can copy boot stanza from other installs to one you boot. Or use configfile to chain to other grub. askubuntu.com/questions/1025656/… – oldfred Dec 2 '18 at 15:38
  • UEFI. As I've read configs from multiboot softwares it seems possible, that is why I've asked this. I will try your suggestion with partitions UUI's. – Piri Dec 2 '18 at 16:19
  • There is a small 3 line grub.cfg in the ESP - efi system partition that will default boot (configfile) to full grub.cfg in one of your installs. You can manually edit or reinstall grub from a different install if desired. Then in that install copy any boot stanzs you want from other installs or configfile to that grub.cfg. I now use labels: askubuntu.com/questions/344125/… – oldfred Dec 2 '18 at 19:14

Multi Install to USB - BIOS/UEFI

Mkusb makes a great base for custom Multi Boot USBs. The following shows how to make a Full install USB, that boots both BIOS and UEFI and then further modify it as a Multi Booter, that even boots ISOs using grub2.

  • Use mkusb to make a Live system on the Installer USB (2GB or larger).

  • Use mkusb to make a Persistent system on the Target 128GB USB using default settings with ~25GB persistence, (remaining NTFS partition is used as Windows accessible data partition).

enter image description here

  • As soon as mkusb finishes, open GParted and delete sdx4, the ISO9660 partition and expand sdx5 into the recovered space, sdx being the device name of the Target drive.

enter image description here

  • Unplug or remove HDD before proceeding further, (optional but recommended, highly recommended in UEFI mode).

  • Boot Installer drive, select Try.

  • Insert Target drive

Start Install Ubuntu...

  • Select Something else.

  • Select sdx5, (on the target drive), and click Change.

enter image description here

  • Select Use as: ext4, Format and Mount point: /.

Don't touch any other partitions (unless adding a /home partition).

  • Select sdx5 as Device for boot loader installation.

  • Complete installation.

  • Cut grub.cfg from sdx5/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

  • Boot the target drive and run sudo update-grub to add all drives to boot menu.

Multi Boot

Multiple OS, both Full install and Live/Persistent can be added to the USB.

Create a drive as suggested above, then divide the expanded partition into parts, (sdx5, sdx6, sdx7... in this case).

You can then install Ubuntu on one partition and other OS on the other partition(s).

  • Divide sdx5 into as many ext4 partitions as you have OS. Size should be about 8GB each or larger.

  • Boot Live mkusb installer and insert the target drive.

  • At partitioning selected "Something else".

  • Choose sdx5 for /.

  • Install bootloader to sdx5.

  • Leave all other partition's format boxes unchecked.

  • Repeat this with sdx6, sdx7, etc, and the OS's you choose to install.

  • After the last install cut grub.cfg from sdx6/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

  • Boot the flash drive and do an update-grub. This will add all the OS to grub.

You can add a few OS ISO's if you wish:

  • Create a folder in the NTFS partition sdx1 named isos.

  • Add a few ISO's.

  • Edit sdx3/boot/grub adding menuentries similar to the following:

    menuentry "xubuntu-18.04.1-desktop-amd64 Partition 6" {
     set isofile="/isos/xubuntu-18.04.1-desktop-amd64.iso"
     set root='(/dev/sdx,msdos2)'
     search --no-floppy --fs-uuid --set=root XXXX-XXXX
     loopback loop ($root)$isofile
     linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
     initrd (loop)/casper/initrd.lz
  • Substitute your sixth, (seventh and eighth), partition's UUID for XXXX-XXXX

  • vmlinuz may need to be vmlinuz.efi for some versions.

  • Each ISO can have it's own casper-rw and home-rw persistence files if desired, but it starts to get a little more complicated as you need to add the "persistent-path" to each menuentry.


Yesterday I've succeed and I will post my resolve:
I have a Sandisk 64gb usb flash drive and I needed multiple partition, multi-boot OS

  1. Step 1:

I created with GParted a MBR partition table with the following contents:

sdb1 -> 4gb ->formatted fat32(labeled Linux)<br/>
sdb2 -> 2gb ->formatted fat32(labeled Android)<br/>
sdb3 -> 5GB ->formatted fat32(labeled Windows)<br/>
sdb4 -> the rest of unallocated space -> formatted NTFS(labeled Stuff)<br/>
  1. Step 2:

    With UNetBootin I've installed:

    sdb1 -> Xubuntu with 2gb persistent storage (latest build)(Lubuntu had some issues after reboot with wifi driver)
    sdb2 -> android-x86_64-8.1
    sdb3 -> for windows10 install I have followed this: This

Edit 1 : After all OS are installed get in GParted and set bootflag to sdb1(linux labeled partition)

  1. Step 3:

    I've Installed grub in sdb1(Linux) like this:

    sudo grub-install --force --root-directory=/media/myusername/LINUX/ /dev/sdb1

  2. Changed grub.cfg file in /media/myusername/LINUX/boot/grub like this:

    if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    set timeout=30
    menuentry 'Xubuntu18.04 Original Selection' {
    search --no-floppy --fs-uuid  --set XXXX-XXXX
    syslinux_source /isolinux/isolinux.bin
    syslinux_configfile /syslinux.cfg
    menuentry 'Android8.1 Original Selection' {
    search --no-floppy --fs-uuid  --set XXXX-XXXX
    syslinux_source ($root)/isolinux/isolinux.bin
    syslinux_configfile ($root)/syslinux.cfg
    menuentry 'Windows10_x64 Original Selection' --class windows --class os  {
    insmod ntfs
    search --no-floppy --fs-uuid  --set XXXXXXXXXXXXXXXX
    ntldr /bootmgr


  1. You need to replace XXXX-XXXX with partition UUID. You can get that by running :blkid /dev/sdbX where 'X' is partition number.
  2. What I got to test:
      • Xubuntu everything works.
      • Android I didn't got to test this.
      • Windows 10 up until partition selection.
  3. If there are any issues with this approach I will edit this further.(most likely to happen in the next few days)
  • I would expect this method to boot BIOS only and not UEFI. If you use a GPT partition table you can use more than four partitions including one for booting UEFI. – C.S.Cameron Dec 8 '18 at 3:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.