Software RAID 1 - disks mirror but the secondary disk does not boot.

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by Da » Fri, 20 Jun 2003 20:35:45



Hi everyone,

I have a RH 9 box set up with software RAID 1 with two IDE disks. They
appear to be mirroring fine but when I test the disk by sapping the
primary for the secondary the mirrored disk does not boot. All that
appears on screen is then the BIOS (POST) boot sequence and the the
letters "LIL" on screen. It doesnt want to boot an further. I am using
LILO boot loader but also got the same when I was using GRUB. Once I
swap the disks back it works fine and it works fine with just the
primary disk in the box. Secondary just doesnt want to boot.

If i do a dmesg there is quite a bit in there about raid 1 but towards
the end it says that both disks are mirroring ok:

raid1: device hda2 operational as mirror 0
raid1: device hdc2 operational as mirror 1
raid1: raid set md1 active with 2 out of 2 mirrors
md: updating md1 RAID superblock on device
md: hda2 [events: 0000000f]<6>(write) hda2's sb offset: 1330496
md: hdc2 [events: 0000000f]<6>(write) hdc2's sb offset: 1330944
md: ... autorun DONE.
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.

________________________________

cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md1 : active raid1 hda2[0] hdc2[1]
      1330496 blocks [2/2] [UU]

md0 : active raid1 hda1[0] hdc1[1]
      2559872 blocks [2/2] [UU]

unused devices: <none>
_________________________________

cat /etc/raidtab
raiddev             /dev/md0
raid-level                  1
nr-raid-disks               2
chunk-size                  64k
persistent-superblock       1
nr-spare-disks              0
    device          /dev/hda1
    raid-disk     0
    device          /dev/hdc1
    raid-disk     1
raiddev             /dev/md1
raid-level                  1
nr-raid-disks               2
chunk-size                  64k
persistent-superblock       1
nr-spare-disks              0
    device          /dev/hda2
    raid-disk     0
    device          /dev/hdc2
    raid-disk     1

Does anyone know what I am doing wrong. I am new to RAID and fairly
new to Linux so go easy on me ;)

Thanks

Dan

 
 
 

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by jbuch.. » Fri, 20 Jun 2003 21:19:29



> I have a RH 9 box set up with software RAID 1 with two IDE disks. They
> appear to be mirroring fine but when I test the disk by sapping the
> primary for the secondary the mirrored disk does not boot. All that

I assume that you mean "swapping", not "sapping"?

I'm not sure what you're trying to do, but I tested my RAID 1, by
pulling one of the power cables from one of the drives. Being a
reckless "cowboy type" I did it while the machine was powered up, but
both the HOWTO and I really recommend against that, do it while the
machine is down.

In my case it worked perfectly, the machine hesitated, and then
everything continued, but with some errors in the messages and some
changes in /proc/mdstat.

I then booted with Knoppix and the HD hooked back up and wiped all the
partitions from the "bad" disk, and then rebooted on one disk. That
worked.

Then I rebuilt the partitions on the "new" disk, and rebuilt the
mirrors with raidhotadd. All went well.

That's how I tested my RAID before I put the machine into use, I don't
know what swapping the disks would do, if anything...

I do recommend against pulling the power cable on a running system, I
just *had* to see what would happen, and was willing to risk hardware
damage to find out. :-)

BTW, you might notice that RH supplies no method to notify you that a
disk has failed, so you have to monitor you logs, mdstat, or
presumably the logwatch emails carefully to notice this. I wrote a
script to page and email me if /proc/mdstat changes...

--

=================== http://www.buchanan1.net/ ==========================
"Sing me a song, you're a singer, Do me a wrong, you're a bringer of evil.
 The devil is never a maker, the less that you give, you're a taker."
 -Ronnie James Dio
================= Visit: http://www.thehungersite.com ==================

 
 
 

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by Natma » Sat, 21 Jun 2003 12:46:30



Quote:> Hi everyone,

> I have a RH 9 box set up with software RAID 1 with two IDE disks. They
> appear to be mirroring fine but when I test the disk by sapping the
> primary for the secondary the mirrored disk does not boot. All that
> appears on screen is then the BIOS (POST) boot sequence and the the
> letters "LIL" on screen. It doesnt want to boot an further. I am using
> LILO boot loader but also got the same when I was using GRUB. Once I
> swap the disks back it works fine and it works fine with just the
> primary disk in the box. Secondary just doesnt want to boot.

> If i do a dmesg there is quite a bit in there about raid 1 but towards
> the end it says that both disks are mirroring ok:

...

> Does anyone know what I am doing wrong. I am new to RAID and fairly
> new to Linux so go easy on me ;)

LILO is a boot manager, so it lives in the MBR of a hard drive.  The MBR
also contains the partition table.  Your RAID (like mine) consisits of
partitions, so all of the data in each partition is mirrored, but the MBR is
not.  So, when you swap disks, you find that LILO isn't properly installed
on the second disk, and it won't boot.

To fix that, you need to setup LILO to work on the 2nd disk.  Unfortunately,
it can be a bit tedious... I have yet to find some sort of automated way of
doing this.   Here's what I did:

1) I made a seperate /boot partition on each disk:
    /dev/hda1 mounted on /boot
    and /dev/hdc1 mounted on /bootc
2) I manually copied all files from /boot to /bootc
3) I copied my existing lilo.conf to lilo-2nd.conf, then edited
lilo-2nd.conf
4) Change boot=/dev/hda to boot=/dev/hdc
5) Change map=/boot/map to map=/bootc/map.  Do the same with message=, any
image= lines, and any initrd= lines.
6) Before any image= lines, add the lines:
    disk=/dev/hdc
    bios=0x80
7) Run "lilo -C /etc/lilo-2nd.conf"

I don't totally understand how LILO interacts with the RAID, so just be
aware that there might be an easier way of doing this (If anyone has a
better way, please correct my idea!).  From what I understand, LILO needs to
know the physical location of the kernel image and ramdisk at boot time (not
the file name, but what sector the file is on).  So, by keeping 2 normal
paritions, I know that changing one won't mess up the other LILO.  Also, the
disk=...bios=  lines are needed because once you switch disks, /dev/hdc will
be /dev/hda, and again, LILO hard-codes this as a number (0x80 for
/dev/hda), so you need to tell LILO what to expect when it boots.

I hope that helps.

Nathan

PS: Since my last disk died, I haven't tried swapping disks to check that
this actually works... but I'm pretty sure that it should.  I guess I'll
find out when a disk dies next time.

 
 
 

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by jbuch.. » Sat, 21 Jun 2003 21:04:47



> To fix that, you need to setup LILO to work on the 2nd disk.  Unfortunately,
> it can be a bit tedious... I have yet to find some sort of automated way of
> doing this.   Here's what I did:
[...]
> I don't totally understand how LILO interacts with the RAID, so just be
> aware that there might be an easier way of doing this (If anyone has a
> better way, please correct my idea!).  From what I understand, LILO needs to

When you set up RAID during install, I think RedHat's install takes
care of this for you. At least I've had no problem booting from either
disk alone on the two machines I've played with RAID on.

Quote:> PS: Since my last disk died, I haven't tried swapping disks to check that
> this actually works... but I'm pretty sure that it should.  I guess I'll
> find out when a disk dies next time.

When you say "swapping" disks, do you literally mean swapping the two
disks, leaving them both in the system, but switching them from one
controller to the other? What failure mode does this emulate?

--

=================== http://www.buchanan1.net/ ==========================
"A women came up to me and said, I'd like to poison your mind
 with wrong ideas that appeal to you, though I am not unkind."
 -They Might be Giants
================= Visit: http://www.thehungersite.com ==================

 
 
 

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by Natma » Sun, 22 Jun 2003 02:45:03




...
> > PS: Since my last disk died, I haven't tried swapping disks to check
that
> > this actually works... but I'm pretty sure that it should.  I guess I'll
> > find out when a disk dies next time.

> When you say "swapping" disks, do you literally mean swapping the two
> disks, leaving them both in the system, but switching them from one
> controller to the other? What failure mode does this emulate?

If hda ever dies, at some point I will need to power off the machine, put in
a new disk, and boot up again.  I'm running the RAID on a normal desktop
style PC, and my BIOS is set to boot from the first hard disk only.  In this
situation I'd have to remove hda, move hdc to hda, and put a new disk in
hdc.  So, the old hdc needs to have LILO properly setup before I start
switching things around.

I figure a good way to make sure that both drives are bootable is to do
exactly what you said, just switch the cables around when the system is
powered down.  This doesn't simulate a failure, but it does make sure that
LILO will work no matter what disk is plugged in as hda.

Nathan

 
 
 

Software RAID 1 - disks mirror but the secondary disk does not boot.

Post by jbuch.. » Sun, 22 Jun 2003 10:53:46



> If hda ever dies, at some point I will need to power off the machine, put in
> a new disk, and boot up again.  I'm running the RAID on a normal desktop
> style PC, and my BIOS is set to boot from the first hard disk only.  In this
> situation I'd have to remove hda, move hdc to hda, and put a new disk in
> hdc.  So, the old hdc needs to have LILO properly setup before I start
> switching things around.
> I figure a good way to make sure that both drives are bootable is to do
> exactly what you said, just switch the cables around when the system is
> powered down.  This doesn't simulate a failure, but it does make sure that
> LILO will work no matter what disk is plugged in as hda.

I see what you're doing.

I've got my machine in production now (the one at work has been
shipped to Michigan)`;, but next time I set one up, I'm going to do
some more experimenting...

--

=================== http://www.buchanan1.net/ ==========================
"Unix was not designed to stop people from doing stupid things, because
 that would also stop them from doing clever things." -Doug Gwyn
================= Visit: http://www.thehungersite.com ==================