How to create a usb multiboot for live media using grub2 and iso’s

Whats required here,

An existing linux operating system using grub2
An existing iso which supports being booted from
A Usb device

Assuming that you are on the linux operating system and the usb is plugged in , open a terminal and fdisk -l as root. From that output you will be able to see which /dev/sdx number the usb is assigned. If you’re not sure , DO NOT CONTINUE For me the device is /dev/sdg. Mount the drive if its not already this can be done in terminal by running mkdir /mnt/usb && mount /dev/sdg /mnt/usb as root , you can use a different mountpoint if you wish , as long as you have read/write access to it.

Next we are going to install grub2 to the device which can be done in terminal with , grub-install –root-directory=/mountpoint /dev/sdx so using my device and mountpoint that command would look like grub-install –root-directory=/mnt/usb /dev/sdg. You will notice that I’m install to /dev/sdg not /dev/sdg1 , that is not a typo , I want to install grub to the mbr of the device not to the partition.

So with grub install the next step is to copy the iso’s to the device , if they aren’t already and make a menu for them. The easiest way to create a menu is to copy the existing /boot/grub/grub.cfg the install has to the device and edit it so this can be done in terminal with cp /boot/grub/grub.cfg /mnt/usb/boot/grub/grub.cfg as root. Now open that file with your favourite text editor. Make sure that any root=(hd0,1) lines point to the usb or if you wish remove them as we can use –fs-uuid –set=root instead , and to which i prefer anyway as using /dev/sdxx can get confused. So in terminal run blkid as root , this is my output here for /dev/sdg1
/dev/sdg1: UUID=”1e5f1e8a-614e-4691-a887-3952cd92ca61″ TYPE=”ext4″
So I would change my uuid lines to –fs-uuid –set=root 1e5f1e8a-614e-4691-a887-3952cd92ca61

Next step is to remove the other menuentries, unless you would like to keep them there of course, and add the entries for the iso’s you have. I have the linuxmint-12-gnome-dvd-32bit-rc.iso iso and the entry i use looks like

menuentry “Linux Mint 12 Gnome” {
loopback loop ($root)/linuxmint-12-gnome-dvd-32bit-rc.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/linuxmint-12-gnome-dvd-32bit-rc.iso
initrd (loop)/casper/initrd.lz
}
Obviously the path of the iso’s has to match yours also i have add reboot and shutdown entries, so if for whatever reason it doesnt work i can reboot/shutdown they look like.
menuentry “Reboot” {
reboot
}
menuentry “Shut Down” {
halt
}

That should get you started , keep in mind that there might be other options that might need to be added, for instance if you are going to use the usb on multiple computers it might pay to add an entry in for compatibility mode etc. Also keep in mind that not all iso’s are bootable.

Advertisements
Tagged with:
Posted in 01Ben, Linux
One comment on “How to create a usb multiboot for live media using grub2 and iso’s
  1. […] year I posted about how to create a multiboot usb device using grub2 to boot the iso , but for those trying to do that with a linumint 32bit iso would see this error: BusyBox v1.18.5 […]

Please feel free to leave a reply.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 69 other followers

%d bloggers like this: