RAID1 root and swap and initrd
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.
Signature · 7 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andre Majorel <[email protected]>
Date: Fri, Dec 15, 2006 at 06:56:30PM +0100
Quoted 7 lines
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
Signature · 7 lines
"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
Quoted 4 lines · Andre Majorel
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
Quoted 2 lines
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
Quoted 8 lines · Gordon Henderson
Quoted 2 lines · Andre Majorel
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
0xFDand trust the kernel auto-detection.
[...]
Quoted 4 lines
Quoted 2 lines
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. :-)
Quoted 5 lines
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/hda1and/dev/hdc1
md2 is/dev/hda2and/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.
Signature · 7 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andre Majorel wrote:
[]
Quoted 8 lines
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/md5are 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).
Quoted 3 lines
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.
Quoted 2 lines
Quoted 2 lines
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
Quoted 7 lines · Michael Tokarev
Andre Majorel wrote:
[]Quoted 5 lines
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.
Quoted 5 lines
Quoted 3 lines
Using boot=/dev/md5 would solve the raid-extra-boot issue but the components of
/dev/md5are 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.
Signature · 7 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andre Majorel wrote:
[]
Quoted 4 lines
Quoted 1 line
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.
Quoted 3 lines
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
Quoted 33 lines · Michael Tokarev
Andre Majorel wrote:
[]Quoted 9 lines
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/md5are 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).
Quoted 7 lines
Quoted 4 lines
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.
Signature · 3 lines
bill davidsen <[email protected]> CTO TMR Associates, Inc Doing interesting things with small computers since 1979
[A late follow-up]
Quoted 39 lines · Bill Davidsen
Quoted 31 lines · Michael Tokarev
Andre Majorel wrote:
[]Quoted 8 lines
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/md5are 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).
Quoted 6 lines
Quoted 3 lines
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.
Quoted 6 lines
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
Quoted 54 lines · Michael Tokarev
[A late follow-up]
Quoted 42 lines · Bill Davidsen
Quoted 33 lines · Michael Tokarev
Andre Majorel wrote:
[]Quoted 9 lines
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/md5are 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).
Quoted 7 lines
Quoted 4 lines
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.
Quoted 7 lines
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.
Quoted 9 lines
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/sdaext
Useful if you can't use a primary for /boot for some reason. grub can do this as well, of course.
Signature · 3 lines
bill davidsen <[email protected]> CTO TMR Associates, Inc Doing interesting things with small computers since 1979