title: Multiboot USB drive # Multiboot USB drive Purpose of this is to use one USB driver to test many distros. When you have many distro ISO's it takes some time to _dd_ them on USB driver and if you whant to try many different then it will take time to _dd_ them everytime when you try new. If there is possible just copy many ISO's on USB driver and run any you need it will save you some time. ## Lets install bootloader Using _fdisk_ to delete/create new partitions on USB drive ```sh mkfs.vfat /dev/sdb1 ``` mount drivet to current pc ```sh mount /dev/sdb1 /mnt/flash0 ``` create dire where will be grub files and grub menu config file ```sh mkdir /mnt/flash0/boot ``` install grub, but you can install also 64bit grub if there is need ```sh grub-install --target=i386-pc --recheck --boot-directory=/mnt/flash0/boot /dev/sdb ``` check with id have usb drive ```sh blkid /dev/sdb1 /dev/sdb1: UUID="D49E-18CC" TYPE="vfat" PARTUUID="5f55bd3d-01" ``` #### Mounting ISO's Some manuals have outdatet filesystem layouts and there is need to investigate current layout by hand. And you need to mount ISO files. ```sh mount -o loop /home/fam/downloads/iso/ubuntu-14.04.3-desktop-i386.iso /mnt/flash0 ``` next is to check bootloader config how they are starting image, there you can find extra options that need to be passed or just with image is used to start ISO ### Boot menu Here is result what you have at the end some Ubuntu isos, OpenWRT image and your own compiled kernel *boot/grub/grub.cfg* ```sh ## Begin /boot/grub/grub.cfg set default=1 set timeout=5 probe -u $root --set=rootuuid set imgdevpath="/dev/disk/by-uuid/$rootuuid" menuentry "GNU/Linux, vmlinux" { linux /vmlinux root=/dev/disk/by-uuid/54F9-27A2 ro } menuentry "Ng-Linux, bzImage" { linux /bzImage root=/dev/disk/by-uuid/54F9-27A2 ro initrd /test.cpio.gz } menuentry "OpenWRT, bzImage" { linux /openwrt-x86-generic-ramfs.bzImage root=/dev/sdb1 ro initrd /openwrt-x86-generic-rootfs.cpio.gz } menuentry "DSL, bzImage" { set isofile='/boot/iso/dsl-4.4.10.iso' loopback loop $isofile linux (loop)/boot/isolinux/linux24 ramdisk_size=100000 init=/etc/init2 lang=us vga=normal atapicd nosound noscsi nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa initrd (loop)/boot/isolinux/minirt24.gz knoppix base norestore legacy } menuentry "Austrumi, bzImage" { set isofile='/boot/iso/austrumi-3.2.6.iso' loopback loop $isofile linux (loop)/austrumi/bzImage initrd (loop)/austrumi/initrd.gz dolivecd text } menuentry '[loopback]archlinux-2015.12.01-dual.iso-mnth' { set isofile='/boot/iso/archlinux-2015.12.01-dual.iso' loopback loop $isofile linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath img_loop=$isofile initrd (loop)/arch/boot/x86_64/archiso.img } menuentry '[loopback]ubuntu-14.04.3-desktop-amd64' { set isofile='/boot/iso/ubuntu-14.04.3-desktop-i386.iso' loopback loop $isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile locale=en_US.UTF-8 initrd (loop)/casper/initrd.lz } menuentry '[loopback]ubuntu-12.04.5-alternate-i386' { set isofile='/boot/iso/ubuntu-12.04.5-alternate-i386.iso' loopback loop $isofile linux (loop)/install/vmlinuz boot=/dev/sda1 iso-scan/filename=$isofile locale=en_US.UTF-8 initrd (loop)/install/initrd.gz } menuentry "[loopback]tails-i386-1.8.1.iso" { set isofile='/boot/iso/tails-i386-1.8.1.iso' loopback loop $isofile linux (loop)/live/vmlinuz2 boot=live config findiso=${isofile} live-media=removable apparmor=1 security=apparmor nopersistent noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 noautologin module=Tails initrd (loop)/live/initrd2.img } ``` ## Tested ### Devices ?Some images could be not loadable becouse not enought RAM? Tested to work on _Asus EEE PC 701_ [6]. And bigger desktop PC (12G RAM). | Distro | Asus | PC | |---|---|---| | my own kernel + initrd | + | + | | OpenWRT | + | - _?no kbd drivers_ | | DSL | - | - | | Austrumi | - | - | | archlinux 2015.12.01 | ? | + | | Ubuntu 14.04.3 | + | + | | Ubuntu 12.04.5 | + | + | | Tails | ? | + | ```text + - works fine - - doesnt work ? - to long to wait, not enought ram? ``` ## Links 1. https://wiki.archlinux.org/index.php/Multiboot_USB_drive 2. https://www.kernel.org/doc/Documentation/kernel-parameters.txt 3. https://liquidat.wordpress.com/2007/10/15/short-tip-get-uuid-of-hard-disks/ 4. http://www.linuxfromscratch.org/lfs/view/stable/chapter08/grub.html 5. http://www.redips.net/linux/create-fat32-usb-drive/ 6. https://en.wikipedia.org/wiki/Asus_Eee_PC