GRUB

To install GRUB on a USB Drive

Here's how to configure a bootable USB drive with GRUB as its boot loader. For specificity, assume the drive has a single ext2 (or ext3 or ext4) partition labeled "multilive" and is mounted as /media/multilive. GRUB supports VFAT and other file systems, too. The label is arbitrary.

Create a directory for GRUB files:

-> mkdir /media/multilive/grub

Identify the device associated with the USB drive. In this example:

-> findfs LABEL=multilive
-> /dev/sdc1

This will be called (hd2,0) when installing GRUB, next:

-> cp /usr/share/grub/i386-redhat/stage{1,2} /media/multilive/grub
-> echo -e "root (hd2,0)\nsetup (hd2)\nquit" | /sbin/grub --batch

(If the USB drive is instead device /dev/sdb1, for example, then use GRUB identifiers hd1 instead of hd2 above.) Create an initial configuration file /media/multilive/grub/grub.conf, which will receive a stanza for each live distribution subsequently installed on the USB drive. Here's a simple starter:

default=0
color cyan/black yellow/black

title Reboot
   reboot
title Shutdown
   halt

The USB drive is now configured to boot a computer via GRUB, although at this point GRUB will offer only the options of restarting and halting the computer.

To install GRUB2 on a USB Drive

Identify and mount the device associated with the USB drive. In this example:

findfs LABEL=ufd
/dev/sdc1
-> mount /dev/sdc1 /media/ufd

Install GRUB 2:

-> grub2-install --boot-directory=/media/ufd /dev/sdc
Installation finished. No error reported.

The effect of option --boot-directory=/media/ufd is to put GRUB's files under directory /grub2 (rather than /boot/grub2).

Create an initial configuration file /media/ufd/grub2/grub.cfg. Here's a simple starter:

set default="0"
insmod ext2
insmod gettext
set timeout=-1

menuentry "Reboot" { 
    reboot
}

menuentry "Shutdown" { 
    halt
}

The USB drive is now configured to boot a computer via GRUB, although at this point GRUB will offer only the options of restarting and halting the computer.

See also:

To boot Lenovo/IBM Rescue and Restore

These notes show how to boot an IBM/Lenovo ThinkPad using GRUB installed on a UFD.

ThinkPad laptops include a bootable Rescue and Restore system (R&R) and a bootable hardware diagnostics utility in addition to the main Windows operating system. In particular, R&R provides the means to restore a damaged Windows installation to its factory configuration. (R&R embeds the Windows setup CD, which is not otherwise shipped with the laptop.) The hard drive's MBR is accordingly specific to a ThinkPad. Both the Windows and R&R systems include the bmgr32 program to install the ThinkPad MBR. If these sectors are overwritten or otherwise corrupted, the laptop may be unable to boot either system offering the bmgr32 savior. A UFD booting GRUB escapes this catch-22.

The following GRUB stanzas apply to an IBM ThinkPad T43 specifically. The hard drive is divided into two primary partitions. The first partition contains Windows and spans most of the capacity. The second partition of a few gigs holds both R&R and the diagnostics utility.

This stanza boots Windows XP on the first partition:

title Windows
   map (hd0) (hd1)
   map (hd1) (hd0)
   rootnoverify (hd1,0)
   makeactive
   chainloader +1
   boot

This stanza boots R&R on the second partition:

title ThinkPad Rescue & Recovery
   map (hd0) (hd1)
   map (hd1) (hd0)
   rootnoverify (hd1,1)
   makeactive
   chainloader +1
   boot

This stanza boots the hardware diagnostic program on the second partition:

title ThinkPad Hardware Diagnostics (PC Doctor).
   map (hd0) (hd1)
   map (hd1) (hd0)
   rootnoverify (hd1,1)
   makeactive
   chainloader /bootsect.dos
   boot