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!!
Meaning:
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.
Quote:
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)
2.- extract the iso
- mount
Code:
# mount -t iso9660 -o ro,loop <iso path> <mounting point>
- copy
Code:
# cp -r <mounting point>/* <your HDD>/os-boot
- umount
Code:
# umount <mounting point>
3.- move the system (all non boot) folder(s) to the parent folder
Code:
# 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
Code:
# 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
Code:
# nano /etc/grub.d/xx_os
with a content like
Code:
#! /bin/sh -e
echo "Adding <OS Name>"
cat << EOF
menuentry "<OS Name or something>"{
set root(hd0,1)
linux <kernel path>
initrd <initrd path>
}
EOF
* 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
Code:
# chmod 644 10_linux
Code:
# grub-mkconfig -o <HDD mounting point>/boot/grub/grub.cfg
ready!!
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:
http://www.justlinux.com/forum/showthread.php?t=150078 (Steps 1, 2, and a little bit of 4)
http://www.dedoimedo.com/computers/grub-2.html
Notes:
(1) This was indeed the root of all my problems. I have GRUB2, and all the howto's I found implemented GRUB Legacy.