Our steps in this guide to Create USB drive contains multi Ubuntu versions, HBCD-PE-64 and multi Windows installation:
1- prepare the USB drive by Ubuntu disks utility.
2- install grub2 and boot files to the USB drive.
3- copy your ISO files and other folders to the USB drive.
4- edit boot menu.
5- examin more than one Linux/Ubuntu from your new multiboot USB drive.
6- easy method to repair/install Windows (no need to boot by Windows ISO).
1- prepare the USB drive by disks utility:
format the -16 gb- USB disk by disk utility, choose (MRB/DOS), creat NFTS partition this very usfull fore files > 4 gb, flage the partition to bootable.
2- install grub2 and boot menu to the USB drive:
mount the USB drive in /mnt by terminal or by disk utility
install grub2 bootloader to the USB drive:
sudo -i
grub-install --boot-directory=/mnt/sdx1/boot /dev/sdx #make sure to sellect the right litter to replace with x
3&4- copy your iso files and other folders to the USB drive and edit boot menu:
at the first copy one Ubuntu ISO file to USB drive root directory,
open your text editor and write the new boot/grub/grub.cfg
or copy one from any Ubuntu ISO and edit it to make your new boot menu entry. as a example i started my work by Ubuntu budgie ISO and my grub.cfg
seems like this:
set timeout=10
set default=0
menuentry "Run ubuntu-budgie-18.04.5-desktop-i386.iso" {
loopback loop /ubuntu-budgie-18.04.5-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-budgie-18.04.5-desktop-i386.iso splash --
initrd (loop)/casper/initrd
}
save the `grub.cfg` file and reboot by your USB drive to test your work, you can login to the first ISO, continue copy the second ISO and add the new menu entry.
Especially for **Ubuntu 23.04** we will add new line to our entry so we can login to test Ubuntu 23.04 not to install it. our neW entry will seems like this:
menuentry "Try or Install ubuntu-23.04-desktop-amd64" {
loopback loop /ubuntu-23.04-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper layerfs-path=minimal.standard.live.squashfs iso-scan/filename=/ubuntu-23.04-desktop-amd64.iso quiet splash locale=en_US bootkbd=us console-setup/layoutcode=us noeject --
initrd (loop)/casper/initrd
}
if you delete `layerfs-path=minimal.standard.live.squashfs` you will login directly to install ubuntu 23.04 so you can add other menu entry for that and it will seems lik this:
menuentry "Try or Install ubuntu-23.04-desktop-amd64" {
loopback loop /ubuntu-23.04-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-23.04-desktop-amd64.iso quiet splash locale=en_US bootkbd=us console-setup/layoutcode=us noeject --
initrd (loop)/casper/initrd
}
Feel free to try any other Ubuntu/Linux ISO file and adjust the new menu entry by the new ISO file name.
Now we will try to copy folders from Ubuntu 22.04 ISO to our USB drive root and add menu entry to boot from this folders, you will copy all ubuntu 22.04 folders except boot folder. our new entry will seems like this;
menuentry "Try or Install Ubuntu 22.04 backup" {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash ---
initrd /casper/initrd.gz
}
I use this way because i make a backup from Ubuntu partiton to filesystem.squashfs file so if i make new one or added new thing to my Ubuntu i will replace it in this (casper) folder and no need to replace all Ubuntu ISO for 22.04 version.
note: all of this menu entrys will boot directly to try or install ubuntu except 23.04 adjusted entry will boot to install ubuntu.
Feel free to choose other version and reboot by USB drive to test your work.
Our last entry will be about another OS like Windows or HBCD PE 64 which builded on Windows 10 64 bit, this very useful tool to repair and install any Windows on your hard disk, with this entry you will need to one file from any Windows ISO and no need to boot by Windows ISO file to fix any problem or make new installation.
Copy all folders -except boot folder just copy its enternal files to boot folder- from hbcd-pe-64.iso to the USB drive root and add this menu entry:
menuentry "Windows Recovery Environment HBCD-PE-64" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 55DD0595418E5BFC
else
search --no-floppy --fs-uuid --set=root 55DD0595418E5BFC
fi
parttool ${root} hidden-
drivemap -s (hd0) ${root}
chainloader +1
}
Replace 55DD0595418E5BFC
by your USB drive uuid that can be known from disk utility.
if you dont want HBCD you can replace it by any windows 7/8/10/11 files by the same way but just chang menu entry name, dont chang any other thing. by this way you can boot by other partition if you have, let we say another windows version files from other partiton.
Feel free to reboot by USB drive and test your last entry.
note: with any Wndows pe version you must add its folders to the USB root, any Windows installation version its folders can be set to folder in the root except sources folder must be in the root.
6- How to repair/install Windows (no need to boot by win ISO) from our new USB drive:
Extract /sources/install.wim
from Windows ISO to you USB drive, if you want multi Windows versions you will rename any new extracted install.wim
so you will be informed which file to install.
After login in to HBCD open WINNTSETUP programe and choose the appropriate install.wim, Windows partitions, installation settings. after WINNTSETUP finished you can reboot to your new Windows.
note: install windows will delete grub boot loader frome your hard disk so if you installed ubuntu you will have to use boot-repair or ubuntu live USB to restore grub boot loader and add Windows entrys to grub menu so no need to windows boot loader again.
To repair Windows from HBCD you will find many tools like EASYBCD to edit/creat Windows boot menu entrys or install Windows boot loader to your hard disk but same the Windows installation this will delete grub boot loader. ther are many other tools in Hbcd like backup/restor, format/partition, test/fix, and more you can explore them.
Finally i hope this guide will help as an introduction to customize your multiboot USB that totally will created in ubuntu.