Boot from USB device
From FrugalWiki
I wanted to install GRUB on a pendrive to be able to boot from it (leaving the HDD MBR untouched). It wasn't that hard to figure it out but maybe someone is seeking for the same information.
1.) Format the pendrive with whatever FS you like, I recommend ext3 but it should work with others (depends on where else you want to use it - Windows will either ignore or want to format an ext3 partition.) I do not recommend setting up more than one partition.
2.) Copy your /boot/grub/ directory from Frugalware to the pendrive.
3.) Start GRUB with 'grub' as root. You will get the GRUB prompt:
grub>
4.) First, try to find the GRUB stage1. It should find the one on the USB device (the one below):
find /boot/grub/stage1 (hd0,1) (hd2,0)
You should be able to distinguish the current device of the running system (here, hd0,1) and the USB device.
Then install GRUB to the required device's MBR.
5.) Make the root partition (here: the USB disk's partition where the copied GRUB directory is located) known to GRUB:
grub> root (hd2,0) Filesystem is type fat, partition type 0xb
6.) Setup GRUB:
grub> setup (hd2) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/fat_stage1_5" exists... yes Running "embed /boot/grub/fat_stage1_5 (hd2)"... 15 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded Done.
7.) Quit GRUB:
grub> quit
8.) Sync disks, reboot, try to boot from the USB device. I had to adjust the device numbers of the Linux installation partition to make booting possible.
I have found this page useful: http://www.freesoftwaremagazine.com/articles/grub_intro/