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

Re: Question about Raid/Boot



On Wed, 03 Sep 2008 07:29:42 +0100
John Allen <john.allen@dublinux.net> wrote:

> Daniel Dickinson wrote:
> > On Tue, 2 Sep 2008 15:12:18 -0400
> > "Tom Allison" <tom@tacocat.net> wrote:
> >
> >   
> >>     
> >
> > Well, RAID1 mirrors the drive so /boot lives on both drives, but
> > grub legacy (grub2 is out, but not the default yet) doesn't
> > understand multidisk devices (e.g. RAID) so it just reads the disk
> > as if it were a regular partition rather than RAID.  
> >
> > Also, because it doesn't understand RAID, you have to manually run
> > GRUB for both drives in order to update the the MBR (the MBR is the
> > master boot record, and in the same sector as the partition tables
> > and is the code that calls grub in order to do the booting after
> > being called by the machine's BIOS).
> >
> > To do that
> >
> >
> > device (hd0) /dev/sda
> > root (hd0,0)
> > setup (hd0)
> >
> > repeat for the second disk (e.g. /dev/sdb)
> >
> >   
> I typically setup the bios to boot from each drive in order, so when 
> disk one is missing it boots from disk 2, and so on.

Unless you using more redundancy than RAID 5 on your disks you really
on need a mirrored partition on disk 1 & 2.  If more than one disk goes
you RAID is hosed anyway so either only disk 1 or 2, or one without the
boot sector, goes and you can boot from the good drive.

> 
> The I do
> for i in b c d e f
> do
>  grub-install /dev/sd$i
> done
> 
> When I replace disk 1, I have to manually (boot from rescue or
> Ubuntu) install grub on /dev/sda, and create the partitions.

Why do you have to manually boot?  If you've got the MBR (as I showed
above) on both disk 1 and 2 and you set the BIOS to boot from the
appropriate disk when the other fails and (assuming you've replaced the
failed disk), partition (as root) the second drive using parted or
fdisk, using mdadm to rebuild add the replacement drive, rebuild the
mirror and you're done.

> # install grub
> grub-install /dev/sda
> # duplicate partition table from another disk
> sfdisk -d /dev/sdb | sfdisk /dev/sda
> # add partitions back to the arrays
> mdadm --manage --add /dev/md0 /dev/sda1
> mdadm --manage --add /dev/md1 /dev/sda2

You can do this without a separate manual boot, just make sure you have
sfdisk installed on your system.

Regards,

Daniel

-- 
And that's my crabbing done for the day.  Got it out of the way early, 
now I have the rest of the afternoon to sniff fragrant tea-roses or 
strangle cute bunnies or something.   -- Michael Devore
GnuPG Key Fingerprint 86 F5 81 A5 D4 2E 1F 1C      http://gnupg.org
The C Shore: http://www.wightman.ca/~cshore

Attachment: signature.asc
Description: PGP signature


Reply to: