Thursday, 25 June 2015

How to have multiple, fully-installed linux OS's on the same Easy2Boot USB drive

Please note: I recommend using VBox+VMUB rather than a real system to perform the installation onto the E2B USB drive because it will be safer (and Mint seems to have a problem if a hard disk is present in the system!). I also recommend you follow this example for Kali linux which is easier and simpler than the method below.


This method allows you to boot to any number of 'fully installed' linux OS's from the one E2B USB drive (i.e. linux will keep all changes and updates, etc. as it is not running from the ISO or a filesystem in memory but is fully installed onto the USB drive).

I used Mint but many other linux installers should work - e.g. manjaro.

WARNING: You should only attempt this if you are familiar with .imgPTN files and installing linux. If you choose the wrong linux install options you could destroy the contents of your E2B drive! If you are not using a Virtual Machine, you could destroy the contents of your system disks too!

In this process we will add a Linux Install .imgPTN file (or LiveCD+Install .imgPTN file) to your E2B USB drive and then install that version of linux to a new 'virtual' partition on the same drive.
We do not need to re-partition the E2B USB drive.

  • Once you install linux, the MINT OS file should not be copied or moved, because it contains boot parameters that are specific to the file's position on the E2B USB drive. WinContig will not change it's position (but a defrag would). This issue can be solved however, by using a bespoke menu entry (see bottom of page for details).
  • We cannot have a Swap partition in this install. Linux is installed onto a single partition only but see the bottom of this post for a workaround.
  • Only MBR-booting is supported.
I used a linux Mint 17 Mate 32-bit ISO and an E2B USB HDD, but the process should work for many linux installers as long as they will install to just a single ext2/3/4 partition.

Basic Steps in Outline

  1. Convert linux ISO to a .imgPTN file
  2. Make a blank .imgPTN file of approx 10GB+ for the new linux install
  3. Boot to linux from E2B and run the linux installer
  4. Install linux to the empty partition
  5. Make a new blank .imgPTN file (30MB) for a new E2B boot partition

Equipment Required

  1. Your NTFS E2B USB HDD or Flash drive
  2. MPI Toolkit (installed on your Windows system)
  3. A suitable linux ISO (e.g. Mint)
  4. A VM that can boot from USB (e.g. VBox+DavidB's VMUB utility) - Note: For Mint, the VM should not contain any virtual hard disks. If you use a real system to perform that install, it should not have a hard disk - OR - boot from a 2nd E2B drive to the ISO (see below).


This process fully installs linux from a linux install ISO/.imgPTN file onto a SINGLE PARTITION with no swap partition. If your linux intaller requires more than one partition then this process won't work.

I used Vbox+VMUB (highly recommended!) which allows me to boot from the E2B USB in VBox with full read/write access.

With Mint, I found that I got a 'cannot unmount /cdrom' message and the install could not get past the "detecting file systems" initial stage. I found the answer was to use a VM which had no virtual disk configured. If you are using a real system, you may have to disable the hard disk controller in the BIOS Setup menu (if possible) or remove the hard disk(s) to get past this problem! As a check, if you run sudo fdisk -l from the bash terminal, only sda (the USB drive) should be listed.

1. Convert your linux ISO to a .imgPTN file - drag and drop the ISO onto the MPI_FAT32 Desktop shortcut - MINT.IMGPTN

IMPORTANT: There should be no dots in the file name except for .IMGPTN.

2. Make an empty folder on the Windows Desktop and drag and drop it onto the MPI_FAT32 Desktop shortcut - use MINT.NOEXT as the filename to save the image to.

The minimum size for my version of MINT was 8GB, so I made a 9GB file. You may want to make a larger file, especially if you need a Swap file (see end of page).

3. Rename MINT.NOEXT to MINT  (no file extension or dot in name) The filename must be identical to the filename made in Step 1.

4. Copy the two files to \_ISO\LINUX folder on the E2B USB drive to the desired menu folder:

\_ISO\LINUX\MINT                    (9GB+)

Now make all files contiguous.

Note: From now on, if you copy or move the MINT file it probably won't work. So place it where you want it to be now! See end of this blog post for a workaround.

5. Boot to the E2B menu and the .imgPTN file to get to the CSM Menu.

WARNINGDo NOT use \_ISO\SWITCH_E2B.exe to switch partitions because it creates a slightly larger partition than E2B creates. Once you have installed the OS, you can switch using any method, but for the initial installation, you must use E2B to switch to the .imgPTN file.

At this point the the E2B drive will now contain two partitions:
  • sdX1 - The small FAT32 bootable partition with the MINT ISO contents
  • sdX3 - The large FAT32 partition that we are going to install MINT to.
 Where X in /dev/sdX3 is the USB drive letter (sda if using VBox+VMUB).

Note: If you are using a real system rather than a VM, you may have problems installing to the same USB drive that you booted from. You can try removing all internal hard disks OR boot from the same version of the MINT ISO file which is on a 2nd E2B/Rufus/dd'd USB drive and install MINT onto the large sdXc partition of the E2B-CSM drive.

Now boot to and run the linux installer - Choose the 'Do something else' option so you can pick what partition to install to.

Recommended: use VBox+DavidB's VMUB - create a new VM for linux-Ubuntu systems with no virtual HDD and use that to boot to the USB drive (see comments below).

6. Choose the /dev/sdX3 FAT32 partition to install to and format it as ext2 (ext3 also works and probably ext4). To format a partition, double-click on the small square in the 'Format' column and set the options as in the screenshot below.

If sdX3 is not listed, then the partition type has probably been set to 0 in the partition table (probably because you re-ran the CSM menu with an unformatted sdX3 partition?).  Use 'sudo sfdisk /dev/sdX' to change the partition type of sdX3 to type 83 (linux) - see here for details - or just remake a new large FAT32 MINT file or use the grub4dos command 'parttype (hd0,2) 0x83' at the grub4dos console in the CSM menu.

The mount point should be set to /  (root).

IMPORTANT: The 'Device for boot loader installation' must also point to sdX3 (the same USB partition)  and NOT to sdX1 !!!  If you are not sure about this, do not proceed as you could lose all E2B partitions!

Installing using VBox+VMUB, so the E2B USB drive is sda in my case.

DO NOT ATTEMPT TO CHANGE THE SIZE OF ANY PARTITION or you will destroy the E2B USB contents!

Ignore any warnings about having no Swap partition. We cannot have an extra partition!

You should see this warning (with MINT) - just 'Continue'. 

If it complains about a /cdrom device being mounted, you may need to make a new fresh linux VM which has no virtual hard disk (vdi/vhd/etc.) attached - the '/cdrom' message usually indicates that the next copy stage will fail to work!

7. Proceed with the install to sdX3 by choosing an account name and password.

It should say 'Copying the files...' and then fairly soon afterwards - 'Almost finished copying the files'.

When finished, restart and at the E2B menu choose the '0 EASY2BOOT - Back to E2B' menu entry and then quit E2B.

8. Now repeat Step 2 to make another .imgPTN file from the empty folder, but name the file MINT.IMGPTNAUTO (alternatively, you could use the MakePartImage Desktop shortcut which will leave the image mounted so that you can perform the changes in Step 9 below more easily. It also lets you choose a menu heading for the CSM menu).

9. Mount MINT.IMGPTNAUTO as a hard disk volume using ImDisk and edit the \menu.lst file inside the image. It will be mounted as a drive volume by ImDisk and given a volume letter - e.g. H:.

Just above the # --- SPECIAL PAYLOAD MENUS --- line add the following lines of text:

title BOOT TO LINUX PARTITION 3\n Boot to full linux with no Swap partition
parttype (hd0,2) 0x83
rootnoverify (hd0,2)
chainloader (hd0,2)+1

(entries here can be deleted)
# --- MISC ----

You can change the first line to whatever you want for a title.
You can also delete all lines under the # --- SPECIAL PAYLOAD MENUS --- line, right down to the # --- MISC ----  line to make a tidier menu.

10. Unmount the volume from ImDisk, e.g. right-click on the drive letter or use the ImDisk Control Panel (if you used the MakePartImage shortcut, continue with the script by pressing [Enter] and it will eventually unmount the image).

11. Copy the MINT.IMGPTNAUTO file to the \_ISO\LINUX folder on the E2B drive.

      Now make all files contiguous.

12. You should now have two entries in the E2B LINUX menu, one for MINT.IMGPTN and one for MINT.IMGPTNAUTO.

You can delete the MINT.IMGPTN file or rename it and use it for just running a LiveCD version.

Boot to the E2B Linux menu and choose the MINT.IMGPTNAUTO menu entry. At the CSM menu, choose the new menu entry you made in step 9 (see item 1 below):

You should now be running a fully installed linux OS from your USB drive :-)

Moving the MINT file

If you want to be able to move the MINT file or copy it to another USB drive, you will need to make a special menu entry in the \menu.lst file.

I found the 'linux' and 'initrd' entries in the /boot/grub/grub.cfg file once I had booted to Mint...

linux /boot/vmlinuz-3.13.0-24-generic root=UUID=f8d72201-f6e9-4047-acc9-508578d29769 ro   quiet splash $vt_handoff
initrd /boot/initrd.img-3.13.0-24-generic

so I added a new menu entry to the \menu.lst file on the E2B drive whilst still in Mint, which uses the 'kernel' and 'initrd'  grub4dos commands:

title Direct boot to MINT\n Uses entry from grub.cfg
# make linux partition type 83
parttype (hd0,2) 0x83
root (hd0,2)
kernel /boot/vmlinuz-3.13.0-24-generic root=UUID=f8d72201-f6e9-4047-acc9-508578d29769 ro   quiet splash $vt_handoff
initrd /boot/initrd.img-3.13.0-24-generic

I then copied the MINT and MINT.imgPTNAUTO files to an E2B NTFS Removable USB flash drive and it booted just fine using this new menu entry :-)

If your linux distro uses syslinux instead of grub as a bootloader, look for the syslinux.cfg file (or other .cfg file) for the correct command lines (search them for 'initrd').

Note: If you see a 'grub' boot menu entry in the CSM menu, you should not need to add a special menu entry. Try it and see if it works.

Add a Swap file

Depending on your version of linux, you may be able to create a Swap file which will occupy part of the space inside the MINT partition - see here for details. I recommend ext3 or better (ext2 can get easily corrupted and this can prevent it from booting).

For Mint, the size recommended for the Swap file is 1.5xRAM size. You should allow for this extra file when creating the large MINT.NOEXT file in step 2.

Please tick one of the 'Reactions' check-boxes to let me know if you found this useful.