Installing grub to USB device

General support questions
markct
Posts: 1
Joined: 2017/09/18 19:24:11

Installing grub to USB device

Postby markct » 2017/09/18 19:32:55

Hi all

I have a fairly old HP Proliant server running ClearOS 6 (I know, not CentOS, but based on it, and I strongly suspect the underlying configuration for what I'm trying to do here is identical for a CentOS machine, hope posting this is okay).

The server has mdadm software RAID 1 on 2 disks in the server, plus a USB disk plugged in for backups.

Unfortunately, there is a known issue with HP Proliants whereby when they have a USB device plugged in they will always try to boot from that USB device. There do not seem to be any BIOS updates or anything else that can fix the issue. This is a real pain for me as I would like to be able to reboot the server remotely. At the moment it is always necessary to have a person on site to unplug the USB disk to allow the system to boot.

As a workaround for this I have seen some people install the system bootloader on to a USB disk so that the system can boot from the USB disk and everything comes up without human intervention.

I have built a dummy server to test this, but am having some trouble.

This is a clean install of ClearOS 6.7 (upgraded to 6.9 after running yum update).

At the moment /dev/sda is my USB disk

/dev/sdb1 and /dev/sdg1 contain the root file system in software RAID /dev/md0

Running:

Code: Select all

grub-install /dev/sdx


appears to work fine for all installed disks. I can boot into the RAID when I boot from either of the system's internal hard drives.

However installing grub on /dev/sda (the USB disk) does not make the device bootable.

When I try to boot from the USB I get the following:

Code: Select all

failed to read the image

Press any key to enter the menu

Booting Linux (2.6...etc. in 0 seconds)

Error 15: File not found

Press any key to continue


Editing the grub configuration manually it appears to be to be pointing to the correct UUID for root.

Is there something else I need to do to make the system bootable. Or can anyone think of any other approaches to accomplish what I'm trying to achieve?

Many thanks in advance.

b24warbaby
Posts: 3
Joined: 2017/10/16 00:15:01

Re: Installing grub to USB device

Postby b24warbaby » 2017/10/27 00:18:38

get rid of that piece of **** and install a supermicro for 1/3 of the price of a HP?

CaViCcHi
Posts: 61
Joined: 2012/04/18 17:03:15

Re: Installing grub to USB device

Postby CaViCcHi » 2017/10/27 02:16:08

let's thank the previous person for the help and for keeping this forum to high standards where people with the same problem can find this question with an answer... as opposed to "just throw it away" :roll:

anyway you need to look into syslinux if you want to boot via USB, also you're gonna need to start using UUIDs for your partitions (or labels) as opposed to the disk name which could change depending on udev's or the system's mood :)

http://www.syslinux.org/wiki/index.php? ... ux_Project

so basically you're gonna need to download (I suggest the latest, 6.03) and get syslinux and a file called mbr.bin. all the most updated instructions are at that link

First you create the partitions, then you're gonna use syslinux to initialize the usb partition you want bootable, then use dd to imprint the mbr in it, and finally with parted you set the partition bootable.

User avatar
TrevorH
Forum Moderator
Posts: 21206
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Installing grub to USB device

Postby TrevorH » 2017/10/27 10:05:55

We ship syslinux and it's available via yum install.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke