Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

How do you install Grub2 on a bootable USB stick?

Somewhere I've heard that Grub2 can boot directly from ".iso" images, so I'm hoping Grub2 will make it easy to drag-and-drop several "liveCD" iso images onto a bootable USB stick and try them out.

share|improve this question

marked as duplicate by Michael Mrozek Sep 22 '13 at 18:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 1 down vote accepted
  1. Install Grub2 on USB drive (replace /USBDRIVE and /dev/sdx with the correct mount point and USB device)

    sudo grub-install --boot-directory=/USBDRIVE/boot /dev/sdx
    
  2. Create required directories

    mkdir /USBDRIVE/iso
    mkdir /USBDRIVE/boot/grub/scripts
    
  3. Save this autoiso.cfg script in the /USBDRIVE/boot/grub/scripts directory

  4. Create a grub.cfg file with the following content in the /USBDRIVE/boot/grub directory

    configfile /boot/grub/scripts/autoiso.cfg
    

Now you can drag-and-drop several "liveCD" iso images into the iso directory of the USB stick and boot them. The following live systems are supported:

  • grml
  • Parted Magic
  • Slax
  • Tinycore
  • Ubuntu
  • live systems with a loopback.cfg
share|improve this answer
    
none of this works for me. i get a lot of errors from grub-install. –  ixtmixilix Feb 26 '13 at 18:17

If the initialization system will scan hard drive devices, as well as optical media devices, for the root filesystem it seems, you should be able to tweak an existing bootable ISO image to work on any hard drive type device, like a USB memory stick. Ubuntu uses Casper for its bootable install/live ISO images and that looks everywhere for the ISO filesystem it wants to mount. I have succeeded in converting them from plain ISO into a hybrid ISO/IMG file that can be dd'd directly to a USB memory stick, and still be burned to a CD or DVD. I achieved this by appending the kernel (and the memory tester image) to the ISO (so it got larger), assigned a sector location for the stage2 image, modified the GRUB source so all the sectors were built in (directly in stage1 and via a built config for stage2), compiled, and finished the image with stage2 appended, and stage1 replacing sector 0.

However I did this with GRUB legacy (v1). I've since moved over to SYSLINUX for my bootable projects, so I never actually worked out the process for GRUB2. As long as it has a way to set defaults or do a built-in config, or there is a way to reference a config file, this should be doable without having to rebuild the ISO.

This only works for ONE ISO image per USB memory stick. Multiple is plausible. It could be easy if they share the same kernel (e.g. having Ubuntu and Kubuntu on the same device).

I do not know of any drag-and-drop tools. I built mine with a script to be run at a root command shell. I have not packaged this into release project and never intended to. There's no documentation but comments in the "build" script itself, so you're on your own. Feel free to download it to see the exact details of what I did: http://ubuntu.slashusr.org/iso-for-hd-2010-10-11-225024.tar.gz

I last used it to build images for Ubuntu 11.04 which you could look at to see the final product of the script. They are at http://ubuntu.slashusr.org/11.04/ The .map files show the sector layouts.

share|improve this answer

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