[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /boot shared between different Linux installs?

From: Andrei Borzenkov
Subject: Re: /boot shared between different Linux installs?
Date: Fri, 22 Apr 2016 06:28:28 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

21.04.2016 22:00, drsmith пишет:
> I'm currently working on installing a server with two logical drives in it:
> sda and sdb.  Each logical drive is going to get an installation of Linux
> and each install has a different purpose.  The first install is mostly used
> for recovery scenarios while the second would be the production
> installation.
> The issue I've run into is that I have two /boot partitions, but the MBR of
> the first disk only points to one grub.conf file.  Manually keeping these
> synchronized isn't something I'd like to do if I could avoid it.
> Either I have to have one shared /boot partition that gets mounted by both
> installations or I have to figure out how to get grub to chainload itself
> from the second drive.  In the chainload scenario, you would see two menus
> where choosing the install on the second hard drive gives you the menu for
> that installation.
> I've run this through the stack-exchange sites and I've tried many searches
> over the past few days, but information on this seems to be rather scarce.
> Maybe I'm not thinking of a better possibility.  Any insight you could
> offer would be greatly appreciated.

Assuming that second GRUB is installed in partition, this would be
something like

menuentry "Chainload GRUB from second partition" --id some-unique-uuid {
  set root=hd0,msdos2
  chainloader +1

In this case boot sector is in the second partition boot block. I would
recommend following practice of searching for partition instead of
hardcoding device name, so if this partition has file system (e.g. it is
/boot partition of second install), it would be something like

menuentry "Chainload GRUB from second partition" --id some-unique-uuid {
  set root=hd0,msdos2
  search --set --hint-bios=hd0,msdos2 --fs-uuid <file-system-uuid>
  chainloader +1

where FS UUID can be obtained by running in Linux

grub-probe -t fs_uuid /boot

(may be grub2-probe depending on distribution).

It is highly recommended to give each menuentry unique ID (grub-mkconfig
does it) which can be used later as reference in setting default boot
choice. Advantage is, this is independent of relative order and allows
adding and removing menu entries while preserving chosen default.

You can also load directly core.img without installing it, using

multiboot /boot/grub/i386-pc/core.img

Using current version (2.02~beta3) this core.img is created by

grub-install --no-bootsector

reply via email to

[Prev in Thread] Current Thread [Next in Thread]