help-grub
[Top][All Lists]
Advanced

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

Re: install on multiple disks


From: Andrey Borzenkov
Subject: Re: install on multiple disks
Date: Tue, 25 Dec 2012 13:09:27 +0400

On Tue, Dec 25, 2012 at 2:48 AM, Ross Boylan
<address@hidden> wrote:
> What do I need to do to install grub to multiple drives so that if one drive
> fails and the one of the other becomes the "first" drive it will boot?
>

I assume you intend to install GRUB2 into MBR?

> This would be with grub 1.96 backported to Debian Lenny; I've been looking
> at the current grub2 manual.  I have software RAID1 on partitions of disks.
> Some disks are MSDOS partitioned and others GPT (with a bios_legacy
> partition).
>

The first thing you need to have either post-MBR space or bios_grub
partition in case of GPT on each disk where GRUB2 is to be installed
to embed core.img.

> The online manual is cryptic.  It suggests
> grub-install /dev/sdb
> might work but....
> My /boot is on a separate partition, also known as /dev/md0

Well ... current GRUB2 support MD disks so in this case you do not
need to do anything special. I have no idea whether grub 1.96 supports
it. If not, you are likely out of luck.

>                                                                               
>           (this is sda1,
> sdb2, sdc2).  So, do I take the default --boot-directory=/boot, or do I need
> --boot-directory=/ because the partition has no /boot directory?  The issue
> here is that there are 2 separate things I need to specify: the location in
> which to install things now, with a running system, and where grub should
> look as it boots off the MBR.  I don't know which of these is
> --boot-directory, and obviously it can't be both.
>
> My second concern, of course, is that the stuff installed in the boot record
> of sdb may refer to the second hard drive (hd1), but when I need it, I'll
> want (hd0).
>

GRUB2 never performs cross-disk installs. If it cannot embed core.img
on disk where boot sector is located, installation fails.

> I don't see any boot sector installation commands in the main command
> listings, nor do I see anything about grub-setup, though the manual mentions
> it several times.
>

"grub-install /dev/sdb" does the following

1. It installs boot sector in the first sector (MBR) on /dev/sdb
2. It determines where /boot/grub (or /boot/grub2 depending on
distribution) is located, which drivers are required to access this
location (disk driver, filesystem driver, MD driver, LVM driver, ...).
It then builds core.img which includes all required drivers.
3. It also stores code in core.img to search for device where
/boot/grub is located at runtime. It normally does it by searching for
filesystem UUID.
4. Finally it tries to embed core.img into either post-MBR gap on
/dev/sdb or on bios_grub partition if disk is GPT. Partition must
exist, GRUB2 will not create it.
5. If embedding is not possible, it may store direct pointer to
/boot/grub/core.img in boot block as long as it is on the same device.

So there is no separate step to install boot block (or, better, it is
but not supported to do directly). grub-install either ensures that
GRBU2 can really boot or it fails. You are not left with
half-installed boot block that cannot find the rest.



reply via email to

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