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.

One way of recovering is to boot the server from a USB stick that has grub
installed and then manually tell grub how to boot from the disks that are
available.

If you are reading this before you replace a disk - be sure to copy the
/boot/grub/menu.lst file from the computer before turning it off. That will
save you a lot of pain.

There are a lot of complicated tutorials on how to do this - however, if you
don't care about the contents of your USB stick, it's really quite simple.

Put your USB disk into working linux computer (don't mount it). On my
computer it is typically recognized as /dev/sdb. If your USB stick is
recognized differently (and/or your hard disk is /dev/sdb) then you must
replace all the instances below of /dev/sdb with whatever your actual USB
stick is being recognized. This is, well, kinda important.

Create a single partition. I typically do this with:

sudo cfdisk /dev/sdb

Feel free to create a FAT32 partition if you want to use this stick on
different machines with different operating systems (including Windows).

Mount the partition you just created:

sudo mount /dev/sdb1 /mnt

Install GRUB:

sudo grub-install --no-floppy --root-directory=/mnt /dev/sdb

That should create a /mnt/boot/grub directory.

It will also create /mnt/boot/grub/device.map, which is a list of disks on
the computer it is running. This list will include not only the USB stick
but your computer's hard disk as well. For example:

(hd0) /dev/hda
(hd1) /dev/sdb

Change to:

(hd0) /dev/sdb

So that the only device showing is your USB stick. Then re-run:

sudo grub-install --root-directory=/mnt /dev/sdb

Now comes the hard part. You need a grub configuration that will make sense
for the server you are booting.

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.

Put the USB stick into the target computer, configure it to boot from the
USB stick via bios, and then you should see the GRUB menu come up.

It's possible that your computer will just boot with your menu.lst file. In
that case - congrats! See the last step below to figure out how to ensure it
can boot without your USB stick. On the other hand, if it fails, you'll need
to experimentally figure out which disk has which partitions and which
kernels. Fortunately grub supports tab completion which makes this job
easier:

When the grub menu comes up, pick from the menu list the most likely candidate and press 'e' for edit.

You should see the various lines from the stanzas for the list item you
picked (i.e. a root, kernel, and initrd stanza). You may use the up/down
arrows to select a line. If that doesn't work, look for hints on the
screen for how to get around. Going left and right on a given line may
require Ctl-b and Ctl-f for back and forward. You also may need to use
the delete key (not backspace) to delete characters

Select a line, delete the characters from the end of the line, and then
try tab completion with various options. For example, on the root line
try typing simply:

root (

And then tab. You should be presented with the available disks (numbered 0
and up). Try typing one of the disks and hitting tab and you should be
presented with the available partitions. Continue this process until you
find the one that seems right.

When you are done and you have successfully booted, you can ensure that
boots will work without the usb key by installing grub on all available
disks: