8

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?

  • 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 '13 at 20:05
  • Related: askubuntu.com/questions/46624/… – landroni Feb 27 '17 at 15:38
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.

  • 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 '14 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 '14 at 14:58
4

For me the best tool to create a Multi-OS live USB is MultiSystem which can be found here. There are many Operating Systems that can be installed via MultiSystem. And you can easily install it on Ubuntu using the project's official repo:

sudo apt-add-repository 'deb http://liveusb.info/multisystem/depot all main' 
wget -q -O - http://liveusb.info/multisystem/depot/multisystem.asc | sudo apt-key add - 

sudo apt-get update 
sudo apt-get install multisystem

Although the site is in French, it's translated into English very satisfactorily via a "Google Translate" powered dropdown list box on the right column (or directly by Google Chrome) but you can also make use of the step-by-step instructions here.

As for your setup, you can initially create 2 partitions using GParted before starting MultiSystem:

  1. 4GB FAT32 partition for MultiSystem, including ISO files, etc. and a blank persistent file to store Ubuntu settings, etc., which can be created in MultiSystem later.

  2. 4GB NTFS partition for Data.

  • 1
    It worked well for me, no hassles. – K7AAY Dec 9 '13 at 22:29
  • errored at first command on a 64-bit Lubuntu 18.04: W: GPG error: http://liveusb.info/multisystem/depot all Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4E940D7FDD7FB8CC .... E: The repository 'http://liveusb.info/multisystem/depot all Release' is not signed. .... N: Updating from such a repository can't be done securely, and is therefore disabled by default. – Nikhil VJ Aug 4 '18 at 3:38
  • @nikhilvj that's strange, I'm using this repository on Ubuntu 18.04 based Linux Mint 19 now (after entering the same 2 commands). Maybe you can ignore this warning and enable it manually - probably the signature they use is not regarded secure enough by the new Ubuntu system. – Sadi Aug 4 '18 at 13:30
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.