linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RAID1 root and swap and initrd
@ 2006-12-15 17:56 Andre Majorel
  2006-12-15 18:30 ` thunder7
  2006-12-15 19:14 ` Gordon Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: Andre Majorel @ 2006-12-15 17:56 UTC (permalink / raw)
  To: linux-raid

Pardon the probably silly question but...

Can you use RAID1 devices for your root and swap with a "straight"
kernel ? (i.e. without the need for initrd/initramfs.)

If that matters, the boot manager would be LILO and each MD device
would be assembled from "parallel" logical partitions.

-- 
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-15 17:56 RAID1 root and swap and initrd Andre Majorel
@ 2006-12-15 18:30 ` thunder7
  2006-12-15 19:14 ` Gordon Henderson
  1 sibling, 0 replies; 10+ messages in thread
From: thunder7 @ 2006-12-15 18:30 UTC (permalink / raw)
  To: Andre Majorel, linux-raid

From: Andre Majorel <aym-xunil@teaser.fr>
Date: Fri, Dec 15, 2006 at 06:56:30PM +0100
> Pardon the probably silly question but...
> 
> Can you use RAID1 devices for your root and swap with a "straight"
> kernel ? (i.e. without the need for initrd/initramfs.)
> 
> If that matters, the boot manager would be LILO and each MD device
> would be assembled from "parallel" logical partitions.

Yes, I do that. Make the partitions type 0xfd and the kernel
automagically assembles any raid-partitions it needs.

Here are some parts of my dmesg:

Linux version 2.6.19-rc5-mm1 (jurriaan@middle) (gcc version 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)) #5 SMP Mon Nov 13 15:55:41 CET 2006
Command line: root=/dev/md2 video=nvidiafb:1600x1200-32@85 atkbd.softrepeat=1
md: considering hdc7 ...
md:  adding hdc7 ...
md: hdc6 has different UUID to hdc7
md: hdc5 has different UUID to hdc7
md:  adding hda7 ...
md: hda6 has different UUID to hdc7
md: hda5 has different UUID to hdc7
md: created md2
md: bind<hda7>
md: bind<hdc7>
md: running: <hdc7><hda7>
raid1: raid set md2 active with 2 out of 2 mirrors
md2: bitmap initialized from disk: read 8/8 pages, set 89 bits, status: 0
created bitmap (123 pages) for device md2
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.

Kind regards,
Jurriaan
-- 
"No," Jewel said faintly, "I know who you are."
She laughed, the laughter thawing the chill of her expression.
"And who is that, exactly?"
"Allasakar's kin."
	Michelle West - The Shining Court
Debian (Unstable) GNU/Linux 2.6.19-rc5-mm1 2x4826 bogomips load load 0.21
the Jack Vance Integral Edition: http://www.integralarchive.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-15 17:56 RAID1 root and swap and initrd Andre Majorel
  2006-12-15 18:30 ` thunder7
@ 2006-12-15 19:14 ` Gordon Henderson
  2006-12-16 21:05   ` Andre Majorel
  1 sibling, 1 reply; 10+ messages in thread
From: Gordon Henderson @ 2006-12-15 19:14 UTC (permalink / raw)
  To: Andre Majorel; +Cc: linux-raid

On Fri, 15 Dec 2006, Andre Majorel wrote:

> Pardon the probably silly question but...
>
> Can you use RAID1 devices for your root and swap with a "straight"
> kernel ? (i.e. without the need for initrd/initramfs.)

Yes - but you need the md (and ide/scsi/sata) drivers compiled into your 
kernel, and make sure the parition types are 0xFD and trust the kernel 
auto-detection.

This is how I do it on all my servers. No initrd etc. (apart from the ones 
that boot off flash, but thats another story!)


% cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 hdc1[1] hda1[0]
        248896 blocks [2/2] [UU]

md2 : active raid1 hdc2[1] hda2[0]
        995904 blocks [2/2] [UU]

md3 : active raid1 hdc3[1] hda3[0]
        2000000 blocks [2/2] [UU]

md5 : active raid1 hdc5[1] hda5[0]
        7815488 blocks [2/2] [UU]

md6 : active raid1 hdc6[1] hda6[0]
        68974976 blocks [2/2] [UU]

unused devices: <none>

% lsmod
Module                  Size  Used by

% cat /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0

/dev/md1        /               ext3    defaults,errors=remount-ro 0       1
/dev/md2        none            swap    sw                      0       0
/dev/md3        /usr            ext3    defaults                0       2
/dev/md5        /var            ext3    defaults                0       2
/dev/md6        /home           ext3    defaults                0       2


> If that matters, the boot manager would be LILO and each MD device
> would be assembled from "parallel" logical partitions.

Lilo is fine. Even kernel auto-detection is fine for me. A nice little tip 
I learned from someone else on the list is to have your md 
devices named after the partition numbers. So:

md1 is /dev/hda1 and /dev/hdc1
md2 is /dev/hda2 and /dev/hdc2

etc.

Gordon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-15 19:14 ` Gordon Henderson
@ 2006-12-16 21:05   ` Andre Majorel
  2006-12-16 21:50     ` Michael Tokarev
  0 siblings, 1 reply; 10+ messages in thread
From: Andre Majorel @ 2006-12-16 21:05 UTC (permalink / raw)
  To: linux-raid

On 2006-12-15 19:14 +0000, Gordon Henderson wrote:
> On Fri, 15 Dec 2006, Andre Majorel wrote:
>
> >Can you use RAID1 devices for your root and swap with a "straight"
> >kernel ? (i.e. without the need for initrd/initramfs.)
> 
> Yes - but you need the md (and ide/scsi/sata) drivers compiled
> into your kernel, and make sure the parition types are 0xFD and
> trust the kernel auto-detection.
[...]
> >If that matters, the boot manager would be LILO and each MD device
> >would be assembled from "parallel" logical partitions.
> 
> Lilo is fine. Even kernel auto-detection is fine for me.

Thanks Jurriaan and Gordon. I think I may still be f*cked,
however. The Lilo doc says you can't use raid-extra-boot=mbr-only
if boot= does not point to a raid device. Which it doesn't because
in my setup, boot=/dev/sda.

Using boot=/dev/md5 would solve the raid-extra-boot issue but the
components of /dev/md5 are not primary partitions (/dev/sda5,
/dev/sdb5) so I don't think that would work.

I *could* run lilo once for each disk after tweaking boot= in
lilo.conf, or just supply a different -M option but I'm not sure.
The Lilo doc is not terribly enlightening. Not for me, anyway. :-)

> A nice little tip I learned from someone else on the list is to
> have your md devices named after the partition numbers. So:
> 
> md1 is /dev/hda1 and /dev/hdc1
> md2 is /dev/hda2 and /dev/hdc2

That's an improvement on what I was doing. Just "renumbered" my
devices that way (mdadm --assemble /dev/md8 -U super-minor
/dev/sda8 /dev/sdb8 ...). Thanks.

-- 
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-16 21:05   ` Andre Majorel
@ 2006-12-16 21:50     ` Michael Tokarev
  2006-12-16 23:01       ` Andre Majorel
  2006-12-19 21:30       ` Bill Davidsen
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Tokarev @ 2006-12-16 21:50 UTC (permalink / raw)
  To: Andre Majorel, linux-raid

Andre Majorel wrote:
[]
> Thanks Jurriaan and Gordon. I think I may still be f*cked,
> however. The Lilo doc says you can't use raid-extra-boot=mbr-only
> if boot= does not point to a raid device. Which it doesn't because
> in my setup, boot=/dev/sda.
> 
> Using boot=/dev/md5 would solve the raid-extra-boot issue but the
> components of /dev/md5 are not primary partitions (/dev/sda5,
> /dev/sdb5) so I don't think that would work.

So just move it to sda1 (or sda2, sda3) from sda5, ensure you've
two identical drives (or at least your boot partitions are layed
up identically), and use boot=/dev/md1 (or md2, md3).  Do NOT
use raid-extra-boot (set it to "none"), but set up standard mbr
code into boot sector of both drives (in debian, it's 'mbr' package;
lilo can be used for that too - once for each drive), and mark your
boot partition on both drives as active.

This is the most clean setup to boot off raid.  You'll have two
drives, both will be bootable, and both will be updated when
you'll run lilo.

Another bonus - if you'll ever install a foreign OS on this system,
which tends to update boot code, all your stuff will still be intact -
the only thing you'll need to do to restore linux boot is to reset
'active' flags for your partitions (and no, winnt disk manager does
not allow you to do so - no ability to set non-dos (non-windows)
partition active).

> I *could* run lilo once for each disk after tweaking boot= in
> lilo.conf, or just supply a different -M option but I'm not sure.
> The Lilo doc is not terribly enlightening. Not for me, anyway. :-)

No, don't do that. Even if you can automate it.  It's error-prone
to say the best, and it will bite you at an unexpected moment.

>> A nice little tip I learned from someone else on the list is to
>> have your md devices named after the partition numbers. So:

That'd be me... ;)

/mjt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-16 21:50     ` Michael Tokarev
@ 2006-12-16 23:01       ` Andre Majorel
  2006-12-17  0:03         ` Michael Tokarev
  2006-12-19 21:30       ` Bill Davidsen
  1 sibling, 1 reply; 10+ messages in thread
From: Andre Majorel @ 2006-12-16 23:01 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: linux-raid

On 2006-12-17 00:50 +0300, Michael Tokarev wrote:
> Andre Majorel wrote:
> []
> > Thanks Jurriaan and Gordon. I think I may still be f*cked,
> > however. The Lilo doc says you can't use raid-extra-boot=mbr-only
> > if boot= does not point to a raid device. Which it doesn't because
> > in my setup, boot=/dev/sda.
> > 
> > Using boot=/dev/md5 would solve the raid-extra-boot issue but the
> > components of /dev/md5 are not primary partitions (/dev/sda5,
> > /dev/sdb5) so I don't think that would work.
> 
> So just move it to sda1 (or sda2, sda3) from sda5

Problem is, the disks are entirely used by an extended partition.
There's nowhere to move sd?5 to.

I think it's possible to turn the first logical partition into a
primary partition by modifying the partition table on the MBR but
I'm not sure I'm up for that.

-- 
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-16 23:01       ` Andre Majorel
@ 2006-12-17  0:03         ` Michael Tokarev
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Tokarev @ 2006-12-17  0:03 UTC (permalink / raw)
  To: Andre Majorel, linux-raid

Andre Majorel wrote:
[]
>> So just move it to sda1 (or sda2, sda3) from sda5
> 
> Problem is, the disks are entirely used by an extended partition.
> There's nowhere to move sd?5 to.

You're using raid, so you've at least two disk drives.

remove one component off all your raid devices (second disk),
repartition the disk, re-add the components back - this will copy
data over to the second diks.  Next repeat the same procedure with
the first disk.

Or something like that -- probably only single partition (on both
disks) needs to be recreated this way.

> I think it's possible to turn the first logical partition into a
> primary partition by modifying the partition table on the MBR but
> I'm not sure I'm up for that.

It's possible to move sda5 to sda1, but not easy - because at the
start of extended partition there's a (relatively large) space for
the "logical partitions", you can't just "relabel" your partitions,
you have to actually move data.

/mjt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-16 21:50     ` Michael Tokarev
  2006-12-16 23:01       ` Andre Majorel
@ 2006-12-19 21:30       ` Bill Davidsen
  2006-12-21 14:45         ` Michael Tokarev
  1 sibling, 1 reply; 10+ messages in thread
From: Bill Davidsen @ 2006-12-19 21:30 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Andre Majorel, linux-raid

Michael Tokarev wrote:
> Andre Majorel wrote:
> []
>   
>> Thanks Jurriaan and Gordon. I think I may still be f*cked,
>> however. The Lilo doc says you can't use raid-extra-boot=mbr-only
>> if boot= does not point to a raid device. Which it doesn't because
>> in my setup, boot=/dev/sda.
>>
>> Using boot=/dev/md5 would solve the raid-extra-boot issue but the
>> components of /dev/md5 are not primary partitions (/dev/sda5,
>> /dev/sdb5) so I don't think that would work.
>>     
>
> So just move it to sda1 (or sda2, sda3) from sda5, ensure you've
> two identical drives (or at least your boot partitions are layed
> up identically), and use boot=/dev/md1 (or md2, md3).  Do NOT
> use raid-extra-boot (set it to "none"), but set up standard mbr
> code into boot sector of both drives (in debian, it's 'mbr' package;
> lilo can be used for that too - once for each drive), and mark your
> boot partition on both drives as active.
>
> This is the most clean setup to boot off raid.  You'll have two
> drives, both will be bootable, and both will be updated when
> you'll run lilo.
>
> Another bonus - if you'll ever install a foreign OS on this system,
> which tends to update boot code, all your stuff will still be intact -
> the only thing you'll need to do to restore linux boot is to reset
> 'active' flags for your partitions (and no, winnt disk manager does
> not allow you to do so - no ability to set non-dos (non-windows)
> partition active).
>
>   
>> I *could* run lilo once for each disk after tweaking boot= in
>> lilo.conf, or just supply a different -M option but I'm not sure.
>> The Lilo doc is not terribly enlightening. Not for me, anyway. :-)
>>     
>
> No, don't do that. Even if you can automate it.  It's error-prone
> to say the best, and it will bite you at an unexpected moment.

The desirable solution is to use the DOS MBR (boot active partition) and 
put the boot stuff in the RAID device. However, you can just write the 
MBR to the hda and then to hdb. Note that you don't play with the 
partition names, the 2nd MBR will only be used if the 1st drive fails, 
and therefore at the BIOS level the 2nd drive will now be hda (or C:) if 
LILO stiff uses the BIOS to load the next sector.

I tried that the hard way once, and didn't even know there was a failure 
until I got mail from the md monitor I was using, saying that md0 was 
degraded. From a sample size of one actual test, it works.

Now the bad news: most BIOS setups will fail over if the 1st drive dies. 
If the first drive returns a bad sector error it will not fail over, it 
will give you some flavor of "I tried my best" message and not boot. 
Sample size of three machines on that problem.

-- 
bill davidsen <davidsen@tmr.com>
  CTO TMR Associates, Inc
  Doing interesting things with small computers since 1979


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-19 21:30       ` Bill Davidsen
@ 2006-12-21 14:45         ` Michael Tokarev
  2006-12-21 18:47           ` Bill Davidsen
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Tokarev @ 2006-12-21 14:45 UTC (permalink / raw)
  To: Bill Davidsen; +Cc: Andre Majorel, linux-raid

[A late follow-up]

Bill Davidsen wrote:
> Michael Tokarev wrote:
>> Andre Majorel wrote:
>> []
>>  
>>> Thanks Jurriaan and Gordon. I think I may still be f*cked,
>>> however. The Lilo doc says you can't use raid-extra-boot=mbr-only
>>> if boot= does not point to a raid device. Which it doesn't because
>>> in my setup, boot=/dev/sda.
>>>
>>> Using boot=/dev/md5 would solve the raid-extra-boot issue but the
>>> components of /dev/md5 are not primary partitions (/dev/sda5,
>>> /dev/sdb5) so I don't think that would work.
>>
>> So just move it to sda1 (or sda2, sda3) from sda5, ensure you've
>> two identical drives (or at least your boot partitions are layed
>> up identically), and use boot=/dev/md1 (or md2, md3).  Do NOT
>> use raid-extra-boot (set it to "none"), but set up standard mbr
>> code into boot sector of both drives (in debian, it's 'mbr' package;
>> lilo can be used for that too - once for each drive), and mark your
>> boot partition on both drives as active.
>>
>> This is the most clean setup to boot off raid.  You'll have two
>> drives, both will be bootable, and both will be updated when
>> you'll run lilo.
>>
>> Another bonus - if you'll ever install a foreign OS on this system,
>> which tends to update boot code, all your stuff will still be intact -
>> the only thing you'll need to do to restore linux boot is to reset
>> 'active' flags for your partitions (and no, winnt disk manager does
>> not allow you to do so - no ability to set non-dos (non-windows)
>> partition active).
>>
>>> I *could* run lilo once for each disk after tweaking boot= in
>>> lilo.conf, or just supply a different -M option but I'm not sure.
>>> The Lilo doc is not terribly enlightening. Not for me, anyway. :-)
>>
>> No, don't do that. Even if you can automate it.  It's error-prone
>> to say the best, and it will bite you at an unexpected moment.
> 
> The desirable solution is to use the DOS MBR (boot active partition) and
> put the boot stuff in the RAID device. However, you can just write the
> MBR to the hda and then to hdb. Note that you don't play with the
> partition names, the 2nd MBR will only be used if the 1st drive fails,
> and therefore at the BIOS level the 2nd drive will now be hda (or C:) if
> LILO stiff uses the BIOS to load the next sector.

Just a small note.  DOS MBR can't boot from non-primary partition.
In this case, the boot code is at sda5, which is on extended partition.

But.  Lilo now has ability to write its own MBR, which, in turn, IS
able to boot of logical partition.

 lilo -M /dev/sda ext

/mjt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: RAID1 root and swap and initrd
  2006-12-21 14:45         ` Michael Tokarev
@ 2006-12-21 18:47           ` Bill Davidsen
  0 siblings, 0 replies; 10+ messages in thread
From: Bill Davidsen @ 2006-12-21 18:47 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Andre Majorel, linux-raid

Michael Tokarev wrote:
> [A late follow-up]
>
> Bill Davidsen wrote:
>   
>> Michael Tokarev wrote:
>>     
>>> Andre Majorel wrote:
>>> []
>>>  
>>>       
>>>> Thanks Jurriaan and Gordon. I think I may still be f*cked,
>>>> however. The Lilo doc says you can't use raid-extra-boot=mbr-only
>>>> if boot= does not point to a raid device. Which it doesn't because
>>>> in my setup, boot=/dev/sda.
>>>>
>>>> Using boot=/dev/md5 would solve the raid-extra-boot issue but the
>>>> components of /dev/md5 are not primary partitions (/dev/sda5,
>>>> /dev/sdb5) so I don't think that would work.
>>>>         
>>> So just move it to sda1 (or sda2, sda3) from sda5, ensure you've
>>> two identical drives (or at least your boot partitions are layed
>>> up identically), and use boot=/dev/md1 (or md2, md3).  Do NOT
>>> use raid-extra-boot (set it to "none"), but set up standard mbr
>>> code into boot sector of both drives (in debian, it's 'mbr' package;
>>> lilo can be used for that too - once for each drive), and mark your
>>> boot partition on both drives as active.
>>>
>>> This is the most clean setup to boot off raid.  You'll have two
>>> drives, both will be bootable, and both will be updated when
>>> you'll run lilo.
>>>
>>> Another bonus - if you'll ever install a foreign OS on this system,
>>> which tends to update boot code, all your stuff will still be intact -
>>> the only thing you'll need to do to restore linux boot is to reset
>>> 'active' flags for your partitions (and no, winnt disk manager does
>>> not allow you to do so - no ability to set non-dos (non-windows)
>>> partition active).
>>>
>>>       
>>>> I *could* run lilo once for each disk after tweaking boot= in
>>>> lilo.conf, or just supply a different -M option but I'm not sure.
>>>> The Lilo doc is not terribly enlightening. Not for me, anyway. :-)
>>>>         
>>> No, don't do that. Even if you can automate it.  It's error-prone
>>> to say the best, and it will bite you at an unexpected moment.
>>>       
>> The desirable solution is to use the DOS MBR (boot active partition) and
>> put the boot stuff in the RAID device. However, you can just write the
>> MBR to the hda and then to hdb. Note that you don't play with the
>> partition names, the 2nd MBR will only be used if the 1st drive fails,
>> and therefore at the BIOS level the 2nd drive will now be hda (or C:) if
>> LILO stiff uses the BIOS to load the next sector.
>>     
>
> Just a small note.  DOS MBR can't boot from non-primary partition.
> In this case, the boot code is at sda5, which is on extended partition.
>
> But.  Lilo now has ability to write its own MBR, which, in turn, IS
> able to boot of logical partition.
>
>  lilo -M /dev/sda ext
>
>   

Useful if you can't use a primary for /boot for some reason. grub can do 
this as well, of course.

-- 
bill davidsen <davidsen@tmr.com>
  CTO TMR Associates, Inc
  Doing interesting things with small computers since 1979


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-12-21 18:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-15 17:56 RAID1 root and swap and initrd Andre Majorel
2006-12-15 18:30 ` thunder7
2006-12-15 19:14 ` Gordon Henderson
2006-12-16 21:05   ` Andre Majorel
2006-12-16 21:50     ` Michael Tokarev
2006-12-16 23:01       ` Andre Majorel
2006-12-17  0:03         ` Michael Tokarev
2006-12-19 21:30       ` Bill Davidsen
2006-12-21 14:45         ` Michael Tokarev
2006-12-21 18:47           ` Bill Davidsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).