[plug] grub2 and the mystery of the moving hard drives
onno at itmaze.com.au
Mon Mar 19 13:31:14 WST 2012
I recommend that you write it up as a blog post and additionally send a
patch for the grub man page to your distro or upstream.
Onno Benschop, ITmaze
On 16/03/2012 7:41 PM, "Brad Campbell" <brad at fnarfbargle.com> wrote:
> G'day all,
> I'm in the process of building a new server. It has 24 drive bays and a
> peculiarity of the system firmware appears to be when I add or remove
> drives, the boot drive moves around in the BIOS order. This means that
> grub2 can rarely (if ever) find the drive its modules are stored on as its
> root directory is hardcoded at install time. Why it can't find it is a
> mystery to me given its stage 1 just loaded stage 1.5 from the boot track,
> but never mind.
> After spending days fighting with this rotten thing booting of USB rescue
> disks to re-install grub, I stumbled across this little trick.
> grub2 can have a config file embedded in its core image. Now, as is
> typical, how you get it in there is not particularly obvious.
> Frustratingly grub-install has no way of letting you pass a config file to
> embed, however grub-mkimage does. grub-install has a way of letting you
> override which grub-mkimage it uses.
> I created 2 files.
> root at test:/root/grub2# cat grub.core.config
> search.fs_uuid root 29f53f33-f452-4382-b598-**ee307a65f360
> set prefix=($root)/grub
> root at test:/root/grub2# cat test
> grub-mkimage -c grub.core.config $@
> Then installed with
> grub-install --grub-mkimage=./test /dev/sde
> Bingo. Grub now has its uuid search algorithm embedded along with the
> config file and the first thing it does is search all accessible partitions
> for the uuid and uses that to access its files. I can happily rearrange
> disks with gay abandon and the system boots every time.
> Note I'm using a separate /boot partition that is plain ext2 and therefore
> the grub files are at /grub rather than /boot/grub.
> I wish this was documented somewhere obvious.
> PLUG discussion list: plug at plug.org.au
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/**membership<http://www.plug.org.au/membership>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the plug