- Member Success Stories (
-   -   Success: Multiple live distros in a single external HDD with GRUB2 (

d3249 12-31-2010 12:34 AM

Success: Multiple live distros in a single external HDD with GRUB2
So, here I am, with my brand new external USB HDD and wonderign what can I do with it. Of curse!! an "all terrain" rescue hard drive with all the live distros I need!!


This is a HOWTO create a rescue HDD containing multiple (or single... but that's not so funny) live distros with the extra feature of implementing GRUB2.


Warning! GRUB 2 is still beta software. Although it already ships with Ubuntu flavors, it is not yet production quality per se. You can probably use it without any troubles, although there is a slight, remote yet possible chance of damage.
Basic Assumptions:
- You have a formatted and sized partition on your HDD
- Your host system has GRUB2 (1)

Part I - Preparing the files

Here I assume you are on your HDD-mounting-point folder

1.- create a file for the boot folder in your HDD (one for each OS)


# mkdir os-boot
2.- extract the iso

- mount

  # mount -t iso9660 -o ro,loop <iso path> <mounting point>
- copy

  # cp -r <mounting point>/* <your HDD>/os-boot
- umount

  # umount <mounting point>
3.- move the system (all non boot) folder(s) to the parent folder

# mv so-boot/sysFolder .
*repeat for each folder EXCEPT boot, isolinux or any other equivalent.

Part II - Installing and configuring GRUB2

For this part I assume you are at /etc/grub.d/

4.- install grub in the HDD


# grub-install --root-directory=<mounting point of sdx1> sdx
- this will create a boot/ folder on your HDD

5.- create a xx_os script for each OS IN THE HOST SYSTEM


# nano /etc/grub.d/xx_os
with a content like

#! /bin/sh -e
echo "Adding <OS Name>"
cat << EOF
menuentry "<OS Name or something>"{
set root(hd0,1)
linux <kernel path>
initrd <initrd path>

* the kernel and initrd paths are relative to the root HDD
* take this data from the menu.lst/isolinux.cfg or equivalent from the boot/ folder of each OS
* REMEMBER to ADD /os-boot/ at the start of each line. This is to give GRUB the right path. More details in step 4 of the first source (below)

6.- generate the grub.cfg

-first, set permissions for 10_linux script to 644 in order to avoid the inclusion of the host system

  # chmod 644 10_linux

# grub-mkconfig -o <HDD mounting point>/boot/grub/grub.cfg

remember to restore the permissions to 755 for 10_linux script.

I also recomend to delete, change location or change permissions (to 644) for every new script you made for this.

sources: (Steps 1, 2, and a little bit of 4)

(1) This was indeed the root of all my problems. I have GRUB2, and all the howto's I found implemented GRUB Legacy.

All times are GMT -5. The time now is 02:53 AM.