help-grub
[Top][All Lists]
Advanced

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

Re: install on multiple disks


From: Ross Boylan
Subject: Re: install on multiple disks
Date: Tue, 25 Dec 2012 14:56:56 -0800

On Tue, 2012-12-25 at 13:09 +0400, Andrey Borzenkov wrote:
> 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?
Yes.
> 
> > 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.
I do.
> 
> > 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.
RAID1 should, and has been, working either way.  That is, /dev/sdb2
looks the same as /dev/md0, except maybe for some control information at
the end.

Legacy grub has been booting from basically this setup, except it's
using sda1 (which subsequently becomes part of md0, a software raid1).

> 
> >                                                                             
> >             (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.
My concern is not that the MBR and other parts will be installed to
different disks, but that the disk information embedded in them will be
obsolete if I move the disks.

For example, when I install to sdb, with sdb2 the /boot partition is
(hd1,2).  I guess that's (hd1,gpt2) in grub 2.  But if sda fails and I
remove it (actually, I'll remove it because it's small) the same
location is (hd0,gpt2).  And so  an embedded reference to hd1 will be
wrong.
> 
> > 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.
In my running system, /boot is a mount of /dev/md0, i.e., RAID.
> 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.
This is the part that concerned me: getting the right disk and directory
in this search.

I assume that means it will look for the RAID, not the underlying
physical disk.  Or maybe the filesystem on the RAID?

So if it's looking on a separate boot partition, it should search
for /grub, whereas if everything's on one partition it would need to
search for /boot/grub.

When my system is running the correct path is /boot/grub, but when
accessing the boot partition directly (e.g., at boot), a search
for /boot/grub will turn up nothing, since there is no /boot directory
on the partition.

> 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.
What I'm looking for is something that will really boot even if I change
which disk is first; may impression from grub legacy was that an install
could satisfy one or the other of "boot the way the hardware is now" vs
"boot in an alternate arrangement," but not both.  I.e., a reference to
either hd0 or hd1 must be embedded.

Of course, if grub 2 uses the RAID device md0 or the filesystem on it
that will be insensitive to the physical disk changes I'm contemplating,
and so maybe it will just work.

Thanks for your very detailed response.
Ross




reply via email to

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