How to make an E2B USB drive using linux

You can install E2B to an existing partition on a USB drive using the  /_ISO/docs/linux_utils/ (FAT32) or (NTFS) linux bash shell script which is included in all Easy2Boot download files (v1.83+).

 Note: E2B v1.87 contains improved scripts for better boot compatibility. E2B v1.89+ is provided as a Windows self-extracting .exe - rename it with a .zip file extension to extract the E2B files from it. will format an existing partition as FAT32, copy the E2B files onto it and then run bootlace to install grub4dos to the MBR:
  1. Download and unzip the Easy2Boot file to a folder on your internal linux hard disk (rename .exe to .zip first - ensure no spaces in folder path)
  2. Open a Terminal session at the \_ISO\docs\linux_utils folder (contains utilities and scripts)
  3. Use chmod to make the files in linux_utils executable (sudo chmod 777 *)
  4. Type ./  or ./  (this requires the bash shell - if you are using the sh shell you will get errors - or try sudo bash ./
Read the ReadMe file in the \_ISO\docs\linux_utils folder for more details and see the article on #114 or my blog post here.
FAT32 is used because defragfs only works on FAT32 volumes.
To format a partition as NTFS, you can use and use 32-bit executable udefrag to defrag the files (E2B v1.83+)
For best bootability, I strongly recommend you create a small (hidden) primary partition at the end of the USB drive as well (use gparted).
Note: If possible, use RMPrepUSB and Windows to prepare your USB drive - this will give better boot compatibility over a wider range of systems because it also makes a small 2nd hidden partition.
You should make all payload (ISO) files contiguous under linux:
Use defragfs on FAT32 volumes.
Use udefrag -om /dev/sdX1 for NTFS volumes (see ReadMe file in linux_utils folder).

BIOS Compatibility

The linux scripts only format a pre-existing partition on your USB drive.
For best bootability/compatibility with all systems, your E2B USB drive should contain 2 PRIMARY PARTITIONS
The second primary partition can be very small and unformatted or it can be larger and formatted - it just needs to be there!
Some BIOSes will not boot from a USB Flash drive correctly unless there are two or more primary partitions. If there is only one Primary partition, some BIOSes will attempt to boot from the USB drive as a floppy disk or super-floppy or ZIP drive and grub4dos will fail to boot correctly.
Also, for best compatibility, you should ensure that the E2B partition is marked as 'Active' (has the boot flag set) and that grub4dos is installed to both the MBR (LBA0) and the Partition Boot Record of the E2B partition (PBR).
Also, do not place any EFI boot files on the E2B drive (i.e. there should be no \EFI folder on the E2B drive). The presence of valid EFI boot files can prevent some BIOSes from booting to the E2B grub4dos menu - they will always try to EFI-boot instead!
If you use the Windows .cmd script to make your E2B USB drive, these features are fully automated for you. You can still use linux to add your ISOs and defrag the files afterwards.

Creating files containing ext2/3/4 filesystems for persistence

For persistence, you often need to create a file on the E2B USB drive which is formatted as an ext2/3/4 filesystem (instructions are always inside the .mnu file). To do this under linux AND have it contiguous (which is required for E2B) - see the thread here.
Use cd to get to the directory where you have mounted the USB drive - e.g. /media/USBDrive, then create a file as follows (example uses 1GB mint-rw, volume name is normally casper-rw)

dd if=/dev/zero of=mint-rw bs=1M count=1024 

mkfs -t ext2 mint-rw -L casper-rw
or for ext3
mkfs.ext3 -F mint-rw -L casper-rw
Making a sparse file using dd may be faster, try this...

dd if=/dev/zero of=casper-rw bs=1M count=0 seek=1024

Making files contiguous

Most ISOs and all persistence files need to be contiguous.

to defrag the file on a FAT32 volume use...

sudo perl ~/Downloads/Easy2Boot/_ISO/docs/linux_utils/defragfs /media/Multiboot -f 
If using an NTFS volume, then defrag the whole volume (udefrag is in the \_ISO\docs\linux_utils folder):
sudo umount /dev/sda1
sudo ./udefrag -om /dev/sda1
Note: udefrag is a 32-bit program, you will need to install 32-bit libraries if you have 64-bit linux (see the ReadMe file for details).
To run udefrag under Ubuntu 64-bit:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
(change to _ISO/docs/linux_utils folder)
sudo chmod 777 *
sudo udefrag -om /dev/sdX1  (where sdX1 is your NTFS USB partition)

Testing using QEMU under linux

1. Run following command to find the E2B USB drive (use lowercase -L for list)
sudo fdisk -l

2. Boot using qemu-system-x86_64

sudo qemu-system-x86_64 -machine accel=kvm:tcg -m 512 -hda /dev/sdc

"/dev/sdc" is the usb device as listed by fdisk, 512 is the amount of memory to allocate.

UEFI support

Unfortunately, there is no linux equivalent of the MakePartImage.cmd Windows script which makes .imgPTN files.

If you want to try UEFI-booting to linux ISOs without using a Windows system and without needing to make the files contiguous, try the E2B grub2 menu system.