User Tools

Site Tools


multiboot_usb_drive

Multiboot USB drive

A multiboot USB flash drive allows booting several ISO files from a single USB flash drive. The ISO files can be copied to the device without unpacking and booted directly. There are several methods available, but they may not work for all ISO images.

Preparation

Create at least one partition and a filesystem supported by GRUB on the USB drive. Select the USB according to the size of ISO file. For Avouch Linux minimum required is the 4GB USB Flash Drive.

Installing GRUB

GRUB can be install for BIOS as well as UEFI sported computer system.

It is assumed that the USB Flash Drive is already formatted FAT filesystem, otherwise you can formate the drive by running the the command: mkfs.vfat /dev/sdc1

Mount the USB Flash drive by running the following command:

# mount -t {file_system} {usb_flash_drive} {mount_point}
# mount -t vfat /dev/sdc1 /mnt

If drive is already mounted then use the following command to un-mount the drive:

# umount -l /dev/sdc1

Create the boot directory by running the following command:

# mkdir -p /mnt/boot

Install GRUB for BIOS

Install GRUB on the USB drive by running the following command:

# sudo grub-install --target=i386-pc --boot-directory=$DATA_MOUNTPOINT/boot --recheck $DISKk
# sudo grub-install --target=i386-pc --boot-directory=/mnt/boot --recheck /dev/sdc

Install GRUB for UEFI

# sudo grub-install --target=x86_64-efi --efi-directory=$EFI_MOUNTPOINT --boot-directory=$DATA_MOUNTPOINT/boot --removable --recheck
# sudo grub-install --target=x86_64-efi --efi-directory=/mnt --boot-directory=/mnt/boot --removable --recheck

Configuring GRUB

Using a template

Manual configuration

When the contents of the Avouch Linux ISO file is copied to the USB Flash Drive the GRUB configuration file is automatically copied to the drive located at /mnt/boot/grub/grub.cfg. If the default configuration file does not work edit the /mnt/boot/grub/grub.cfg file manually. If you want to use UUID then change the the root partition UUID:

/mnt/boot/grub/grub.cfg
----
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  $UUID
else
search --no-floppy --fs-uuid --set=root $UUID
fi

If you wanted to use USB Flash Drive lable to set root partition, then change the label:

/mnt/boot/grub/grub.cfg
----
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 $LABLE_OF_USB
else
search --no-floppy --set=root -l $LABLE_OF_USB
fi

Boot entries

If the contents of Avouch ISO file is copied to the USB Flash Drive then default boot entries are good to go, but if you want to boot multiple ISO images then add the boot entries as follows:

It is assumed that the ISO images are stored in the boot/iso/ directory on the same filesystem where GRUB is installed. Otherwise it would be necessary to prefix the path to ISO file with device identification when using the loopback command, for example loopback loop (hd1,2)$isofile.
/mnt/boot/grub/grub.cfg
----
menuentry "Start Avouch Linux 64-bit ISO" {
set gfxpayload=keep
set isofile="/boot/iso/Avouch-Live-0.1.1-x86_64.iso"
loopback loop $isofile
linux	(loop)/isolinux/vmlinuz root=live:CDLABEL=AVOUCHLIVE iso-scan/filename=$isofile rootfstype=auto ro rd.live.image noprompt noeject quiet splash rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 
initrd	(loop)/isolinux/initramfs.img
}

You can use as many as entries you want, just change the ISO image file name in the boot menu entries.

multiboot_usb_drive.txt · Last modified: 2019/10/19 18:54 by avouchor

Logo by Jakub T. Jankiewicz; license CC-BY-SA

Powered by DokuWiki