[CentOS] Re: Replacing failed software RAID drive

Wed Oct 10 22:36:04 UTC 2007
Hugh E Cruickshank <hugh at forsoft.com>

From: Scott Silva Sent: October 10, 2007 15:15
> on 10/10/2007 2:46 PM Hugh E Cruickshank spake the following:
> > From: Les Mikesell
> >> Hugh E Cruickshank wrote:
> >>> From: Les Mikesell Sent: October 7, 2007 18:53
> >>>
> >>>> Then reinstall grub on the drive.
> >>> Now I have some questions:
> >>>
> >>> 1. Since the /boot partition was mirrored and will be restored on the
> >>>    new sda drive I do not really want to do a full grub install. From
> >>>    what I have read that will overwrite existing /boot/grub/grub.conf
> >>>    file. So I just want to write the MBR on the drive. How to I do
> >>>    that (the docs I have found were rather unclear on that aspect)?
> >>>
> >>> 2. Can a install grub on the replaced boot drive with the system still
> >>>    running?
> >> Yes, after the /boot partition re-sync has completed, execute grub and:
> >>
> >> root (hd0,0)
> >> setup (hd0)
> >> quit
> >>
> >> If you aren't able to keep the system running while doing the swap, you
> >> can also do this from the rescue mode boot, but you should have the
> >> contents on the /boot partition first.
> >>
> > 
> > Sorry to be obtuse here but I just want to make very sure of what I am
> > doing before I do it. Will the "setup" command only write the MBR?
> > 
> >>From my reading the GNU GRUB manual I got the distinct impression that
> > the "setup" command will also write/rewrite the /boot partition (which
> > I would like to avoid). The documentation for the setup command states:
> > 
> >     Set up the installation of GRUB automatically. This command uses
> >     the more flexible command install (see Section 13.3.18 [install],
> >     page 44) in the backend and installs Chapter 13: The list of
> >     available commands 49 GRUB into the device install device. If
> >     image device is specified, then find the GRUB images (see Chapter
> >     10 [Images], page 29) in the device image device, otherwise use the
> >     current root device, which can be set by the command root. If
> >     install device is a hard disk, then embed a Stage 1.5 in the disk
> >     if possible.
> > 
> >     The option �--prefix� specifies the directory under which GRUB
> >     images are put. If it is not specified, GRUB automatically
> >     searches them in �/boot/grub� and �/grub�.
> > 
> >     The options �--force-lba� and �--stage2� are just passed to install
> >     if specified. See Section 13.3.18 [install], page 44, for more
> >     information.
> > 
> > The second paragraph tends to imply that /boot/grub will be written
> > to by default and I do not think that this is what I want to happen.
> > 
> > Thanks again for everyone's input (especially Les). It is greatly
> > appreciated.
> What "setup" command?

That would be the grub setup command.

> You boot from a rescue disk if your system isn't running already.
> If booting from rescue disk chroot to your installed files.
> execute grub
> at its prompt run the following;
> root (hd0,0)
> setup (hd0)
> quit
> That should let you boot into your stuff.

I know that will let me boot but that was not what I was asking about.
As per the documentation I quoted it appears that the grub setup
command will overwrite the /boot partition that has been restored from
the mirror drive. As far as I can see that is not desirable. All I want
to do is install the GRUB MBR and leave the contents of the /boot
partition intact.

My question is basically will the grub setup command only install the
MBR or will it also overwrite the /boot partition as well?

Regards, Hugh

-- 
Hugh E Cruickshank, Forward Software, www.forward-software.com