Skip to contentSkip to conversation

mbr-install for Raid 1

DISCUSSION Michael Tokarev 3 participants 8 messages Oct 5, 2004 – Oct 6, 2004 1 message not in the archive MD RAID

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

[I'm getting quite some questions similar to this
one -- so instead of replying to every and each, I'm posting to linux-raid@, to be able to refer to this post in the future... ;)]

Quoted 9 lines · Zeno R.R. Davatz

Hi!

I am just reading a post of yours regarding using 'install-mbr' for linux-raid.

Something I do not understand about the post:
http://lists.debian.org/debian-testing/2004/04/msg00054.html

is following:
"mark your boot raid partitions active...". What do you mean by that?

Set the partitions (single partition on every disk) where your root raid device resides to be active with fdisk.

Quoted 1 line

Do you mean to mark all the first partitions of all the disks /dev/sd[abcd]1 as boot with fdisk?

Not necessary first ones, but it is simpler to have your root fs on first partition. Again, it is the root-raid partition that should be active.

Quoted 1 line

In that case I would have to do install-mbr /dev/md0 --force

No, you would have to use boot=/dev/md0 in your lilo.conf, and install-mbr /dev/sd[abcd]1.

Quoted 1 line

Is that correct?

Basically, the scenario is as follows.

Standard mbr (master boot record) from mbr package (note lilo also have it, see lilo -M) is installed into standard place (where BIOS will expect it to be) into all your disks once (don't forget to install the same mbr when you plug new disk). The mbr code (it resides on the first sector of the disk) works by reading partition table, finding partition marked as "active" (or "boot" -- the same flag but different terminology), loading boot record from that partition and executing it. Mbr code is stable and you don't have to change it -- the first sector of your disks will never change. In contrast, you will do eg kernel upgrades and similar stuff, for which lilo boot tables needs to be refreshed, and that should be done on all disks (to be able to boot off any disk in case first one fails). For this to work, you set up lilo to write it's boot record into the device where your root filesystem is -- it is raid1 array created off all active (boot) partitions of all your disks. Lilo writes boot record into the beginning of md0, and raid code propagates that boot record into your disks, all of them -- remember, md0 is composed of active partitions on all your disks -- this is exactly the place where mbr code will look for the bootloader.

So, you have the same mbr code on all your disks (installed once when you configure each disk), and "second-stage" boot record, installed by lilo into md0 and again propagated to all disks (into active or boot partition of each), which will be loaded by mbr -- this boot record will be updated -- on all disks -- when you re-run lilo. In case any disk fails, you have the same boot code and sequence on every other disk, so you could boot off any working, non-failed disk.

But be warned -- boot (active) partition on every disk should be at the exactly same place, or else file offsets written by lilo will be valid for one disk but not valid for other.

/mjt

#2 lore raw

Hi!

Thanks for your prompt and detailed response, I appreciate your time! I will post it on our website as well.

I done as follows and get the following:

Quoted 2 lines · On Tue, 05 Oct 2004 13:08:19 +0400 Michael Tokarev <[email protected]> wrote:

No, you would have to use boot=/dev/md0 in your lilo.conf, and install-mbr /dev/sd[abcd]1.

Now when I boot, I get

MBR FA:

I hit A for 'Advanced', then I get:

MBR 1234A:

Then I hit '1' then I get:

MBR
MBR
MBR FA:

And nothing happens :-(

Any hints?

Thanks for your Feedback.

Zeno

#3 lore raw
In reply to Michael Tokarev

Hi

I am just thinking of one more problem that turned up.

You suppose that I am running a RAID1 as you say I should install the boot-image of lilo to my root partition because Install-Mbr checks for it there. My problem: My Root-Partition is a RAID5. I would like to boot from a RAID1 and get my RAID5 going from there.

Any hints?
Zeno

Quoted 70 lines · On Tue, 05 Oct 2004 13:08:19 +0400 Michael Tokarev <[email protected]> wrote:

[I'm getting quite some questions similar to this
one -- so instead of replying to every and each, I'm posting to linux-raid@, to be able to refer to this post in the future... ;)]

Quoted 9 lines · Zeno R.R. Davatz

Hi!

I am just reading a post of yours regarding using 'install-mbr' for linux-raid.

Something I do not understand about the post:
http://lists.debian.org/debian-testing/2004/04/msg00054.html

is following:
"mark your boot raid partitions active...". What do you mean by that?

Set the partitions (single partition on every disk) where your root raid device resides to be active with fdisk.

Quoted 1 line

Do you mean to mark all the first partitions of all the disks /dev/sd[abcd]1 as boot with fdisk?

Not necessary first ones, but it is simpler to have your root fs on first partition. Again, it is the root-raid partition that should be active.

Quoted 1 line

In that case I would have to do install-mbr /dev/md0 --force

No, you would have to use boot=/dev/md0 in your lilo.conf, and install-mbr /dev/sd[abcd]1.

Quoted 1 line

Is that correct?

Basically, the scenario is as follows.

Standard mbr (master boot record) from mbr package (note lilo also have it, see lilo -M) is installed into standard place (where BIOS will expect it to be) into all your disks once (don't forget to install the same mbr when you plug new disk). The mbr code (it resides on the first sector of the disk) works by reading partition table, finding partition marked as "active" (or "boot" -- the same flag but different terminology), loading boot record from that partition and executing it. Mbr code is stable and you don't have to change it -- the first sector of your disks will never change. In contrast, you will do eg kernel upgrades and similar stuff, for which lilo boot tables needs to be refreshed, and that should be done on all disks (to be able to boot off any disk in case first one fails). For this to work, you set up lilo to write it's boot record into the device where your root filesystem is -- it is raid1 array created off all active (boot) partitions of all your disks. Lilo writes boot record into the beginning of md0, and raid code propagates that boot record into your disks, all of them -- remember, md0 is composed of active partitions on all your disks -- this is exactly the place where mbr code will look for the bootloader.

So, you have the same mbr code on all your disks (installed once when you configure each disk), and "second-stage" boot record, installed by lilo into md0 and again propagated to all disks (into active or boot partition of each), which will be loaded by mbr -- this boot record will be updated -- on all disks -- when you re-run lilo. In case any disk fails, you have the same boot code and sequence on every other disk, so you could boot off any working, non-failed disk.

But be warned -- boot (active) partition on every disk should be at the exactly same place, or else file offsets written by lilo will be valid for one disk but not valid for other.

/mjt

Signature · 12 lines
Mit freundlichen Grüssen / best regards

Zeno Davatz
Verkauf & Akquisition

+41 1 350 85 86

www.ywesee.com > intellectual capital connected > www.oddb.org
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 6 lines · Zeno R.R. Davatz

I am just thinking of one more problem that turned up.

You suppose that I am running a RAID1 as you say I should install the boot-image of lilo to my root partition because Install-Mbr checks for it there. My problem: My Root-Partition is a RAID5. I would like to boot from a RAID1 and get my RAID5 going from there.

Basically the same procedure. Just replace the words "root partition" with "boot partition" or "partition on which you install your kernel" in Michaels instructions.

Bernd Fischer

#5 lore raw

Re: mbr-install for Raid 1 with Root on Raid5

Bernd!

thanks for your Mail, Time and Help.

Quoted 8 lines · On Tue, 05 Oct 2004 20:25:02 +0200 Bernd Fischer wrote:
Quoted 4 lines

You suppose that I am running a RAID1 as you say I should install the boot-image of lilo to my root partition because Install-Mbr checks for it there. My problem: My Root-Partition is a RAID5. I would like to boot from a RAID1 and get my RAID5 going from there.

Basically the same procedure. Just replace the words "root partition" with "boot partition" or "partition on which you install your kernel" in Michaels instructions.

I'm doing exactly that or at least I believe so.

I run
install-mbr -t 150 /dev/sda1
install-mbr -t 150 /dev/sdb1
install-mbr -t 150 /dev/sdc1
install-mbr -t 150 /dev/sdd1

then in lilo.conf I put

boot = /dev/md0
root = /dev/md2

then I reboot and I get:

MBR FA: (I hit 'A')
MBR 1234F: (I hit '1')
MBR
MBR FA:

.. and nothing boots. MBR just stands there forever.

Any hints?

Thanks for your Feedback.

Zeno

PS: Lilo can not write it's boot-image on RAID5, only on RAID1.

#6 lore raw

Re: mbr-install for Raid 1, rerun Lilo necessary?

In reply to Michael Tokarev
Quoted 1 line · On Tue, 05 Oct 2004 13:08:19 +0400 Michael Tokarev <[email protected]> wrote:

No, you would have to use boot=/dev/md0 in your lilo.conf,

Do I have to run 'lilo -v' so lilo gets this?

Because whenever I run lilo -v (22.5.8) with 'boot=/dev/md0 I get the wonderful Error of:
Fatal: Trying to map files from unnamed device 0x0000 (NFS ?)

Any hints?

Thanks
Zeno

#7 lore raw

Re: mbr-install for Raid 1, rerun Lilo necessary?

Quoted 3 lines · Zeno R.R. Davatz
Quoted 1 line

No, you would have to use boot=/dev/md0 in your lilo.conf,

Do I have to run 'lilo -v' so lilo gets this?

As usual, you have to run lilo everytime you install a new kernel or edit lilo.conf

Quoted 4 lines

Because whenever I run lilo -v (22.5.8) with 'boot=/dev/md0 I get the wonderful Error of:
Fatal: Trying to map files from unnamed device 0x0000 (NFS ?)

Any hints?

I had the same problem some time ago. AFAIR it went away when I updated to lilo 22.6
As a workaround, create a symlink to /dev/md0 ( e.g. /dev/MD0 ) and use this as your boot device in lilo.conf.

Bernd Fischer

#8 lore raw

Re: mbr-install for Raid 1, mdadm -a /dev/md0 /dev/sda1

Hi Bernd

Thanks for your prompt reply.

Quoted 12 lines · On Wed, 06 Oct 2004 18:16:57 +0200 Bernd Fischer wrote:
Quoted 3 lines · Zeno R.R. Davatz
Quoted 1 line

No, you would have to use boot=/dev/md0 in your lilo.conf,

Do I have to run 'lilo -v' so lilo gets this?

As usual, you have to run lilo everytime you install a new kernel or edit lilo.conf

Quoted 2 lines

Because whenever I run lilo -v (22.5.8) with 'boot=/dev/md0 I get the wonderful Error of:
Fatal: Trying to map files from unnamed device 0x0000 (NFS ?)

Quoted 6 lines
Quoted 1 line

Any hints?

I had the same problem some time ago. AFAIR it went away when I updated to lilo 22.6
As a workaround, create a symlink to /dev/md0 ( e.g. /dev/MD0 ) and use this as your boot device in lilo.conf.

I managed to boot my /dev/md2 (using find . -xdev | cpio -pm /mnt/newroot instead of cp -ax / /mnt/newroot to copy my system to Raid). Now I am doing 'mdadam -a /dev/md2 /dev/sda3'

as next I would do 'mdadm -a /dev/md0 /dev/sda1'

Will the lilo problem then vanish?

Thanks for your Feedback.
Zeno