Tuesday, 15 April 2014

HP Microserver Gen8 - Boot from 5th SATA ODD Port using USB + GRUB


I discovered that my HP Microserver Gen8 does not boot from the 5th SATA port (the Optical Bay) when the controller is in AHCI mode. The server does boot from this drive if the controller is set to SATA Legacy mode (by changing the controller boot order for #2 to be first in sequence, ODD bays 1-4 are on controller #1, ODD port is on controller #2). I believe it can also boot from this port using the B120i RAID but regardless, I wanted to use AHCI mode.

This solution is not ideal, but it's a decent workaround. I wanted to boot Linux (Debian 7.4 with OpenMediaVault installed). I use a permanently connected USB with grub installed to boot the operating system installed on a 500gb 2.5" drive I installed in the top drive bay.

Remove all drives in the 4 main bays
Install Linux, then from inside the new Linux installation:
 1. Zero the USB
   dd if=/dev/zero of=/dev/sdd

2. Create a 128 mb partion at the start of the USB
   fdisk /dev/sdd
   ... use 'n' to create a partition
   mkfs -t ext2 /dev/sdd1
   mkdir /tmp/myusb
   mount /dev/sdd1 /tmp/myusb
   mkdir /tmp/myusb/boot

3. Install grub to the USB, making sure the boot directory is on the USB drive:
   grub-install --boot-directory=/tmp/myusb/boot /dev/sdd

3. Update the grub config, outputting to the USB.
   update-grub --output=/tmp/myusb/boot/grub/grub.cfg

4. Reboot the system and it should now boot grub from the usb (make sure the BIOS is configured for USB boot). The drives can now be reinstalled in to the main drive bays.