125 - Create a dual-partition USB boot drive using YUMI



YUMI allows you to make a multiboot USB drive. There are Windows and linux versions of YUMI.

It works by installing syslinux onto your USB drive partition as the boot manager. You can pick from a variety of different ISOs and YUMI will extract the files from the ISO and place them on your USB drive.

However, YUMI will only boot to one partition.

Here, I outline a way to create a two-partition Removable USB drive using YUMI and syslinux (with the help from grub4dos)

In this example I will use 4 ISOs

Partition 1
  • linuxmint-201403-cinnamon-dvd-64bit.iso
  • solydx64_201407.iso
  • ubuntu-14.04-desktop-amd64.iso
Partition 2
  • systemrescuecd-x86-4.1.0.iso.

Method

1. Wipe and partition and format a USB drive - create two Primary FAT32 partitions.

If you are a linux user, you can use gparted. If you are a Windows user, you can use a free tool such as Easeus Home Partition Master

2. Download and run YUMI

Select the first partition in YUMI and choose your ISO.

You must select the type of distro first. If you want persistence and the option is offered, you can select that option and adjust the size using the slider.

Once you have added all three ISOs, quit YUMI.

You can test it now if you wish to make sure it boots and works. Note that some distros - e.g. Linux Mint will not boot from the USb drive if using a Virtual Machine.

3. If you are running Windows and have a Removable USB drive, Windows won't be able to access the 2nd partition, so we need to swap over the partitions

Run RMPrepUSB - select the USB drive in the Drive selection box and type CTRL+O (Drive - Set Windows accessible partition) - enter 2 when prompted and hit OK

You should now see that Windows can only see the 2nd partition.

4. Now run YUMI again and select the systemrescuecd-x86-4.1.0.iso (in this example) and complete the installation process.

If using linux, be sure to select the 2nd partition on the USB drive!

5. If you ran the Windows Step 3 above, now change back to the 1st partition by using RMPrepUSB - Ctrl+O again and enter 2

Ensure you can see the first partition again in Windows Explorer.

6. We now need to install grub4dos to the MBR:

Windows - Run RMPrepUSB - click the Install grub4dos button - Yes (MBR) - if prompted copy over the grldr file.

Linux - download grub4dos (use the latest version of 0.4.5c NOT 0.4.6a which is an Alpha version which may have bugs!)
Run bootlace --time-out=0 /dev/sdu (where sdu is your USB drive - e.g. sdc do NOT specify a partition such as sdc1, you must specify the drive)
copy the grldr file to the root of the first partition

7. We now need to make a grub4dos menu (\menu.lst) that will allow us to boot to either syslinux partition - here is a simple example:

\menu.lst

title Boot to Partition 1\n Run syslinux from partition 1
root (hd0,0)
chainloader (hd0,0)+1
boot

title Boot to Partition 2\n Run syslinux from partition 2
root (hd0,1)
chainloader (hd0,1)+1
boot


That's it!

Theory

The USB drive has one Master Boot Record (MBR) and two Partition Boot Records (PBRs)

MBR - contains grub4dos boot loader which loads the \grldr file which then looks for a menu.lst file
PBR1 - The first partition contains a boot loader which was written by YUMI which loads the \multiboot\ldlinux.sys file which then looks for a \multiboot\syslinux.cfg file (on the first partition only)
PBR2 - The 2nd partition contains a boot loader written by YUMI which loads the \multiboot\ldlinux.sys file which then looks for a \multiboot\syslinux.cfg file (on the second partition only)

You can see from the folder structure how YUMI has organised the folders: here is an example for the solydx distro

\multiboot\syslinux.cfg - main menu which loads \multiboot\menu\linux.cfg for linux menu
\multiboot\menu\linux.cfg - linux menu which loads \multiboot\solydx64_201407\isolinux\isolinux.cfg
\multiboot\solydx64_201407\isolinux\isolinux.cfg - contains menu entries for solyd

e.g.
#start solydx64_201407
LABEL solydx64_201407
MENU LABEL solydx64_201407
MENU INDENT 1
CONFIG /multiboot/solydx64_201407/isolinux/isolinux.cfg
APPEND /multiboot/solydx64_201407/isolinux
#end solydx64_201407

\multiboot\solydx64_201407\live - contains the squashfs files used for the 2nd boot stage of linux

Improving the menu

The first menu allows us to boot from either partition, but it would be nice to be able to boot directly to any of these payloads.

For example, the System Restore CD menu is rather awkward because we have to select the 32-bit boot option because we have the x86 32-bit version of the ISO. It would be nice if we could just boot directly to the System Restore distro...

First, we need to find the .cfg file. Examine the files on the 2nd partition (use RMPrepUSB - Ctrl+O if you need to swap partitions)...

The \multiboot\syslinux.cfg file leads us to /multiboot/menu/system.cfg
The \multiboot\menu\system.cfg file leads us to /multiboot/systemrescuecd-x86-4.1.0/isolinux/isolinux.cfg

This file contains menu entries such as (for the 32-bit menu entry):
MENU BEGIN
MENU TITLE B) Standard 32bit kernel (rescue32) with more choice...

LABEL rescue32_1
MENU LABEL 1. SystemRescueCd with default options
LINUX rescue32
INITRD initram.igz
APPEND subdir=multiboot/systemrescuecd-x86-4.1.0
TEXT HELP
Boot standard 32bit kernel with default options (should always work)
ENDTEXT

We can translate this into a grub4dos menu like this:
title System Rescue 32-bit\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot

Notice how we need to put the full path in. An alternative would be to set the root directory - e.g. :

title System Rescue 32-bit\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot


We can repeat this process for the other payloads if we wish and do away with all the syslinux menus completely.

Here is an example \menu.lst file

title Run a linux distro \n Run any YUMI linux from Partition 1
chainloader (hd0,0)+1

title \n
root ()


title System Rescue\n
root ()
title =============\n
root ()

title System Rescue 32-bit Standard\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot

title \n
root ()


title System Rescue 32-bit (Alternative)\nBoot alternative 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /altker32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot

title System Rescue Alternative 32-bit kernel with console in high resolution (1024x768)\nBoot alternative 32-bit kernel with framebuffer console in high resolution\nKMS graphic drivers (Kernel-Mode-Settings) will be disabled.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset vga=791
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot

title System Rescue Alternative 32-bit kernel with a standard VGA console (no KMS)\nBoot alternative 32-bit kernel and use standard low-resolution VGA\nconsole. KMS graphic drivers (Kernel-Mode-Settings) will be disabled.\nTry this if you can't get a working console or new a low-resolution mode
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot


title System Rescue - console in 800x600\nBoot alternative 32-bit kernel and use standard graphic driver in 800x600\nKMS graphic drivers (Kernel-Mode-Settings) will be used if appropriate.\nUse that to get a 800x600 resolution and have a KMS compatible card.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 docache
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot





You can change the menu text colours and add a background bitmap - see here for a tutorial on grub4dos.

e.g. Try adding this to the top of the menu