114 - How to make an Easy2Boot MultiBoot USB Flash drive using linux

web analytics




This is how to make a grub4dos Easy2Boot USB MultiBoot USB Flash drive under linux.

Once you have made the E2B USB drive, you can boot pretty much any number of linux LiveCD ISOs just by copying them to the E2B drive!

Other instructions here.

Note: Look in the Easy2Boot download files in the \_ISO\docs\linux_utils folder for  bootlace and defragfs. In E2B v1.54+ there is also a fmt.sh script which will format a USB partition as FAT32, copy over E2B and install the bootloader (see the ReadMe_fmt.sh.txt file for details).

Requirements

1. A system running linux
2. (optional)  gparted  (or boot from a gparted ISO)
3. bootlace.com (can be found inside the latest grub4dos download here - use version 0.4.5c  NOT 0.4.6a)  - Note: on Easy2Boot v1.53 and later, bootlace.com and defragfs are included in the E2B download \_ISO\docs\linux_utils folder.
4. The Easy2Boot zip download from Tutorial 72a 

So before you begin, copy the bootlace.com file (if not in the E2B download) and the Easy2Boot.zip file from Tutorial 72a to somewhere accessible on your linux system (e.g. to another spare USB drive or a folder on your hard disk)

I tested this by using two USB drives, one containing a bootable linux OS + the bootlace.com+Easy2Boot.zip files, and the other USB drive was the one I wanted to prepare as my E2B drive. 
I booted from the linux OS USB drive and then partitioned and formatted the other USB drive under linux.

You may also see here.

Due to a lack of linux defrag utilities, I strongly recommend that you format the partition using FAT32 so that you can make the files contiguous using the linux defragfs utility.

Steps to make an E2B USB drive under linux:

1. Format your USB Flash Drive to use a Single Partition (FAT32 type 0C - or if possible add a small 2nd partition too, to help bootability - some systems will not boot from USB Flash correctly unless it has 2 or more partitions so it is always best to add a tiny (hidden) partition) use  gparted - or do it the hard way using fdisk as follows:
  • Open a terminal and type sudo su
  • Type fdisk -l             (and note which device is your USB Drive)
  • Type fdisk /dev/sdx (replacing x with your actual usb device)
  • Type d                     (to delete the existing partition) (press d again to delete the next partition, etc.)
  • Type n                     (to create a new partition)
  • Type p                     (for primary partition)
  • Type 1                      (to create the first partition)
  • Press Enter              (to use the first cylinder)
  • Press Enter again     (to use the default value as the last cylinder)
  • Type a                     (for active)
  • Type 1                     (to mark the first partition active "bootable")
  • Type t                      (for partition type)
  • Type c                     (to use fat32 partition)
  • Type w                    (to write the changes and close fdisk)
Create a Fat32 Filesystem on the USB Flash Drive:

fdisk -l                                                            (check which device is the USB Flash drive)
umount /dev/sdx1                                            (to unmount the mounted partition if it is mounted)
sudo mkfs.vfat -F 32 -n MULTIBOOT /dev/sdx1  (to format the partition as fat32)

2. Check you can access the drive that has bootlace.com and the Easy2Boot zip file on it using ls, e.g. ls /mnt/yyyy/    (where yyy is the name of the device - tip: type mount  to see what mounted devices are present)

If you cannot access the drive that contains bootlace.com, then mount it using the commands:

mkdir /mnt/mysrc
mount /dev/sdb1 /mnt/mysrc

and then you will be able to use /mnt/mysrc/bootlace.com  to run bootlace (see step 3)

If you cannot access the empty, newly formatted USB drive, then mount it using these commands:

fdisk -l                                             (check which device is the USB Flash drive)  OR try...        sudo fdisk -l /dev/sdX                        (where X is a or b or c or d, etc, until you find the ISB drive)
sudo mkdir /mnt/newusb
sudo mount /dev/sdx1 /mnt/newusb            (where x is the letter for the USB Flash drive)


3. Install grub4dos onto the USB Flash Drive:

Assuming that the bootlace.com executable is on /mnt/mysrc and the USB drive is sdx, use the following command to install grub4dos to the MBR with 0 seconds timeout

sudo /mnt/mysrc/bootlace.com --time-out=0  /dev/sdX             (note that we specify the whole disk sdx)

If you have formatted the drive as NTFS using gparted, you may need to add the --ntfs  parameter to the command line
Note: Use 0.4.5c version (0.4.6a is Beta and may give a segmentation fault when run).

If you use the files from the Easy2Boot download, it may not have execute permissions, run a bash shell and cd to the same folder as the bootlace.com file...

sudo cp boot* /                                                    (copy bootlace.com and bootlace64.com to /)
sudo chmod +rwx /boot*                                       (change permissions to execute,read,write)
sudo /bootlace.com --time-out=0 /dev/sdX              (where X is a or b or c or d, etc.)   - or try sudo /bootlace64.com --time-out=0 /dev/sdX 


you should see the response

   Success.


4. Extract the Easy2Boot files from the E2B zip file and copy it onto the USB Flash drive

e.g.
unzip /mnt/mysrc/Easy2Boot_v1.54.zip -d /mnt/newusb/


5. Copy all your linux livecd ISOs to the \_ISO\MAINMENU or \_ISO\LINUX folder using the GUI File Manager in linux. 

For other ISOs or for linux ISOs+Persistence, follow the instructions in the Easy2Boot tutorial.

6. Make all files contiguous

After adding any files to the E2B USB drive you need to ensure that all files are contiguous. 'danboid' suggests using defragfs (ext2/ext3 only) - you may need to omit the .pl file extension depending on what version of defragfs you have.

df
sudo perl defragfs.pl /mnt/newusb/ -f

This is reported to also work on FAT32 volumes (TBC) but not on NTFS volumes.

Note: To defrag files on FAT32 and NTFS, you could boot from the E2B USB drive to a mini-Windows OS (such as Mini-XP on a Hirens ISO or even a Windows Install ISO) and run RMPrepUSB - Ctrl+F2 to run WinContig under Mini-Windows. Copy over the portable version of RMPrepUSB (or just WinContig) to the USB drive first.

To run RMPrepUSB from WinPE or WINE, you may need to copy the msvbvm60.dll file from the RMPrepUSB\WINPE_EXTRA folder to the same folder as RMPrepUSB.exe. Also, if WinPE does not include a variety of different fonts and so you cannot see any text on the controls when RMPrepUSB runs, select English204 as the language.


Creating files containing ext2/3/4 filesystems

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.ext2 mint-rw -L casper-rw


to defrag the ext2 filesystem...

sudo perl ~/Downloads/Easy2Boot/_ISO/docs/linux_utils/defragfs /media/Multiboot -f