You need to do this from inside a linux system (use a livecd in case you can't boot your linux right now).
Preface:
You should already know how to partition your usb device and create desired filesystems and also mounting them.
Also, being familiar with GRUB is a must
Visit GRUB's manual for making yourself familiar with the environment
Process:
All the work is done by the grub-install command, but you have to give it 2 parameters:
- The root directory to place the images into (a partition on your usb device for GRUB)
- The device mbr in which the command installs GRUB bootloader
After selecting the partition for GRUB's installation, mount it and run this command:
grub-install --root-directory=/media/disk /dev/sdb
I had mounted my usb device's desired partition in the folder /media/disk, so now the GRUB images are placed inside this directory. After the script is finished, it tells you about the device.map file, as it tells you, check to see if all your devices are listed there, if so, you are all set and ready for the last step.
Last Step:
Now you have to create a menu file for GRUB, which tells the bootloader where to load the kernel from. This is my own menu.lst file which I copied from my installed system to the flash memory:
# the default choice, 0 is the first one default 0 # timeout in seconds, to wait for choice timeout 5 # set the colors of the screen color cyan/blue white/blue # hd0 is the usb device itself # my hard drive became hd1 title Debian GNU/Linux root (hd1,4) kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda5 ro initrd /boot/initrd.img-2.6.26-2-amd64 title Debian GNU/Linux(single-user mode) root (hd1,4) kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda5 ro single initrd /boot/initrd.img-2.6.26-2-amd64
Change the locations for your own kernel files, also change the root device to the appropriate partition where you installed your system's boot directory.
Now you are all set and ready to use the usb device, double check the menu entries, make sure you put this menu file in your usb device inside the /boot/grub/ directory.
Now reboot the system with your usb connected to it, change the BIOS settings if needed (to boot any usb devices first), and see if it works
Note: Test it with virtual environments to make sure everything is correct before leaving your system.
qemu example for testing: qemu -hda /dev/sdb
Hope this could help you out






MultiQuote


|