Taken from https://current.workingdirectory.net/posts/2009/grub-on-usb/

repeated here in case the above site disappears

Booting from a USB stick into Grub

Often when replacing a failed disk in a RAID1 setup (or in many other cases) grub fails to load. Usually it's because the bios is expecting to find a boot loader and the various files on which the boot loader depends on the first disk in the machine. If that's the disk that was replaced, then loading grub will fail.

If you are using grub1... Hopefully you have a copy of the menu.lst file from the server. In that case, simply copy it to /mnt/boot/grub/ and you are ready to go. Otherwise, you'll need to craft one. Below is a sample.

# uncomment these lines if you want to send grub to a serial console
#serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
#terminal serial
default     0
timeout     5
color cyan/blue white/blue

# simple setup
title           Debian GNU/Linux, kernel 2.6.26-2-686
root            (hd0,5)
kernel          /boot/vmlinuz-2.6.26-2-686 root=/dev/hda6 ro
initrd          /boot/initrd.img-2.6.26-2-686

# here's a more complicated one
title       Debian GNU/Linux, kernel 2.6.26-2-vserver-amd64
root        (hd0,0)
kernel      /vmlinuz-2.6.26-2-vserver-amd64 root=/dev/mapper/vg_pianeta0-root \
ro console=ttyS0,115200n8 cryptopts=target=md1_crypt,source=/dev/md1 \
cryptopts=target=md2_crypt,source=/dev/md2,lvm=vg_pianeta0-root
initrd      /initrd.img-2.6.26-2-vserver-amd64

If you are using grub2...

grub-mkconfig -o /mnt/boot/grub/grub.cfg

Then edit. You might want something like:

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal_input serial
terminal_output serial
insmod raid
insmod mdraid
insmod part_gpt
set default=0
set timeout=5

menuentry "Debian GNU/Linux, with Linux 2.6.32-trunk-vserver-amd64" --class debian --class gnu-linux --class gnu --class os {
    set root='(hd0,1)'
    search --no-floppy --fs-uuid --set 7682a24c-b06f-456b-b3d4-bcb7294d81e2
    echo    Loading Linux 2.6.32-trunk-vserver-amd64 ...
    linux   /vmlinuz-2.6.32-trunk-vserver-amd64 root=/dev/mapper/vg_chicken0-root ro quiet
    echo    Loading initial ramdisk ...
    initrd  /initrd.img-2.6.32-trunk-vserver-amd64
  }

Use_USB_drives_to_boot_grub (last edited 2018-05-25 05:26:32 by fuzzy)