11

I want to create a recovery flash drive. I have my 8 gb flash drive[Kingston data traveller] with me. I also have the required .iso files for a>Ubuntu 13.10 b>Boot-repair disk c>AVG Rescue CD

I Wish to create 4 partitions(3 for each bootable .iso and one for data storage. Also, I want a way in which I can select which OS to boot each time I boot from USB.

So, is there a way to install GRUB on USB as well as the three other live distros? And how to create such a setup?

2
  • Have a look at UNetbootin. It allows you to write several ISO files to an USB device, and iirc you can choose which one to boot from a menu. It's using syslinux, not grub, though. And a single FAT partition, in which files might even conflict, I guess. But it might be worth a try.
    – MvG
    Dec 9, 2013 at 20:05
  • Related: askubuntu.com/questions/46624/…
    – landroni
    Feb 27, 2017 at 15:38

4 Answers 4

3

I have not used MultiSystem, but that one I have seen recommended as well as several others. MultiBootUSB - Install and boot multiple Linux from Pendrive / Flash drive / USB disk w/grub2

https://help.ubuntu.com/community/InstallAndBootMultipleLinuxFromPendriveFlashDriveUSBDisk

See yumi for multi-boot versions

http://www.pendrivelinux.com/

But to understand it better you can just install grub2 to the flash drive, create your own grub.cfg with boot stanzas and copy ISO into flash drive. Very similar to a hard drive install like this link.

https://help.ubuntu.com/community/Grub2/ISOBoot

To install grub2 into a flash drive, default /media now varies depending on version. New version add the user to the path. Also assumes sdb as flash drive, confirm that is correct if not sure. Label partition - if label is grub2 & mount:

sudo grub-install --root-directory=/media/grub2 /dev/sdb

Newer versions automount with $USER name also, this one labeled MC4GB, with user fred

sudo grub-install --root-directory=/media/fred/MC4GB /dev/sdb

In creating grub.cfg, the boot drive is always hd0, so if directly booting from flash drive setting will be hd0,Y where Y is partition usually 1.

loopback loop (hd0,1)$isofile

Otherwise examples are like these:

https://help.ubuntu.com/community/Grub2/ISOBoot/Examples

First entry in my grub.cfg in MC4GB

set default=0 
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=800x600

menuentry "Ubuntu 13.04" {
set isofile="/boot/iso/ubuntu-13.04-desktop-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile nomodeset 
initrd (loop)/casper/initrd.lz
}

menuentry " " {
set root= 
}

Note I added nomodeset to all entries as I have nVidia. Also new versions now use vmlinuz.efi for both BIOS & UEFI boot. Older versions were just vmlinuz. Other distributions may need different boot parameters. Find example in above example thread or mount and check what ISO has for its boot parameters.

2
  • Where should the grub.cfg file be placed within the USB drive? Should it be in the root, as a sibline to the boot/ directory?
    – Greg
    Dec 9, 2014 at 14:28
  • I always put it in the "normal" location. Grub when compiled probably can set that to be anything, but /boot/grub/grub.cfg works for me.
    – oldfred
    Dec 9, 2014 at 14:58
3

A solution tested from Ubuntu 20.04 and later is to use Ventoy. Directly from the tool description:

Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. With ventoy, you don't need to format the disk over and over, you just need to copy the image files to the USB drive and boot it. You can copy many iso files at a time and ventoy will give you a boot menu to select them. Both Legacy BIOS and UEFI are supported in the same way. Both MBR and GPT partition style are supported in the same way.

I have created a bootable USB where I have copied my ISO files simply with a copy/paste procedure, so that they are shown in a menu when the USB stick is used as a bootable drive. At the same time, I can use this USB also to store my personal data (they do not appear in the Ventoy Menu).

This means that when I use this USB stick as a bootable drive I have a menu like this (screenshot taken from the official website):

ventoy menu

When I open it via Nautilus, it is like a normal USB stick where you can put your files (screenshot taken from my Ubuntu 20.04):

nautilus

Ventoy does not come in a deb format or with an installation script, so you need to download Ventoy from the release page. If you download the .tar.gz version (I'll refer to version 1.0.61 in the following examples), you can extract it by issuing in the terminal:

sudo tar xzf ventoy-1.0.61-linux.tar.gz -C /opt

Considering the meaning of /opt folder, I think that /opt is the best choice in terms of destination folder.

Now, you need to give permissions to at least Ventoy2Disk.sh and VentoyGUI.x86_64:

sudo chmod +x /opt/ventoy-1.0.61/Ventoy2Disk.sh /opt/ventoy-1.0.61/VentoyGUI.x86_64

Now you are ready to use it. To create a bootable USB mapped as /dev/usb (always use lsblk to identify correctly your USB disk!) with a GPT partitioning, you can run

sudo bash /opt/ventoy-1.0.61/Ventoy2Disk.sh -I -g /dev/sdb

Following, the list of parameters provided by Ventoy2Disk.sh:

Ventoy2Disk.sh CMD [ OPTION ] /dev/sdX
  CMD:
    -i   install ventoy to sdX (fail if disk already installed with ventoy)
    -I   force install ventoy to sdX (no matter installed or not)
    -u   update ventoy in sdX
    
  OPTION: (optional)
   -r SIZE_MB  preserve some space at the bottom of the disk (only for install)
   -s          enable secure boot support (default is disabled)
   -g          use GPT partition style, default is MBR style (only for install)

Otherwise, you can run Ventoy with a graphical interface using:

sudo /opt/ventoy-1.0.61/VentoyGUI.x86_64

Further details are available in Ventoy Installation.

Another interesting source is this article from RedHat.com: Creating a multi-boot Linux desktop system

1

Here is a menuentry for booting an iso on the second partition of a multiboot flash drive, (as suggested to me by sudodus).

menuentry "ubuntu-12.04-desktop-i386 Partition 2" {
    set isofile="/ubuntu-12.04-desktop-i386.iso"
    set root='(/dev/sda,msdos2)'
    search --no-floppy --fs-uuid --set=root XXXX-XXXX
    loopback loop ($root)$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
    initrd (loop)/casper/initrd.lz
}

Substitute your second, third & forth partition's UUID for XXXX-XXXX The menuentrys for Boot-repair disk & AVG Rescue CD may have different form than Ubuntu. MultiBootUSB script should tell you how to write these.

1

Multi-Boot Full System install

The size of flash drives has increased since this question was first asked. It is now quite reasonable to make a multi boot drive using Full system installs.

Full installs are more stable and secure than persistent installs, but not as quick to make. They are better at utilizing disk space as no fixed size casper-rw file or partition is required. They are not much use at installing an OS, for installing an OS booting an ISO works fine.

  • Using GParted create GPT partition table on large flash drive.

  • Make as many ext4 partitions as you have OS. Size should be about 8GB each or larger.

  • Boot Live drive in UEFI mode and insert large target drive.

  • At partitioning selected "Something else".

  • Choose sdc1 for /.

  • Install bootloader to root of the USB drive.

  • Leave all other partition's format boxes unchecked.

  • Install choosing encryption of home directory if desired, Full disk encryption does not work for me on flash drive.

  • Repeat this with sdc2, sdc3, etc, and the OS's you choose to install.

  • After the last install boot the flash drive and do an update-grub. This will add all the OS to grub.cfg

You can leave a partition for any ISO's you wish to Live boot or persistent boot, to make an installer flash drive, loop mount these using grub.cfg.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .