# Restoring Grub Boot on a remote server with RAID1

The assumption is that things already have gone southward and you have recovered the server with a rescue system.

## Checking whether server boots via UEFI or BIOS

Check if a folder */sys/firmware/efi* is present and if you can find the string "EFI v" in the Kernel ringbuffer via *dmesg|grep "EFI v"*. The latter one only produces safe results if the bootup sequence is still contained in the ringbuffer. The first one will be a pretty safe indication that the server is using UEFI.

## RAID1 layout
Find out with lsblk which blockdevices do exist and how many RAID partitions there are.

Check all */dev/mdX* partitions and find out what their mountpoints are. When you locate the partition for */* you can check the filesystem table in */etc/fstab* to doublecheck your findings.

Let's asume partiotions and mountpoints look like this:

/dev/md0 SWAP
/dev/md1 /boot
/dev/md2 /
/dev/md3 /extra

## Reasemble your original system under /mnt

Mount */* and */boot* under */mnt*.

<pre><code class="language-plaintext">mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
</code></pre>

If your system runs with UEFI you also have an UEFI partion that you need to mount instead of the */boot* partition. As I found myself on a BIOS system I will continue with this case only.

Include the rescue system's */dev*, */proc*, */sys*, and */run* folders under */mnt*.

<pre><code class="language-plaintext">#mount --bind /dev /mnt/dev
#mount --bind /proc /mnt/proc
#mount --bind /sys /mnt/sys
#mount --bind /run /mnt/run
</code></pre>

## Change root to /mnt

<pre><code class="language-plaintext">#chroot /mnt
</code></pre>

## Reinstall GRUB on all physical disks

<pre><code class="language-plaintext">#grub-install /dev/sda
#grub-install /dev/sdb
</code></pre>

## Update GRUB

<pre><code class="language-plaintext">#update-grub
</code></pre>

## Exit chroot environment, unmount all devices under /mnt and reboot

<pre><code class="language-plaintext">#exit

#umount /mnt/dev
#umount /mnt/proc
#umount /mnt/sys
#umount /mnt/run
#umount /mnt/boot
#umount /mnt

#reboot
</code></pre>
