-   Linux - Newbie (
-   -   RAID at root partition in Debian. (

caio2710 02-11-2010 04:57 AM

RAID at root partition in Debian.
Hi, I'm migrating from Windows to Linux, then be patient with me. :-)

Well, I read some articles about RAID. The RAID level 1 interested me because of its redundancy in both drives. And I successfully made it in a couple of partitions. But, I always did it after Linux installation. Then, I create both partitions, use 'mdadm' to create raidtab and RAID device (md0, for example) and then I format the RAID device with 'mkfs' and mount it.

Until there, it's all OK.

But my problem is to mirror ALL the hard disk, inclusive root partition.
To do that, I guess I need no Linux installation, then create the RAID (md0, raidtab, etc) and after that install Linux in RAID device created.

But I'm new in Linux world and I have no idea how to do that.

I use Debian Lenny, so I need a solution that uses only the first DVD of this distribution.

Caio Fernando Bertoldi Paes de Andrade.

Note: Sorry my possible grammatical and semantical errors, I'm learning English. :X

chrism01 02-11-2010 09:51 PM

Maybe you just need to go slower through the install; in RHEL/Centos there's an option during install to either take the default OR manually specify the layout, inc RAID, LVM.
Can't comment on Debian.

Quakeboy02 02-11-2010 10:13 PM

I believe that in Debian it's done from the partitioning menu. If I were asking this question though, I'd first ask it of yahoo or google. I'm pretty sure there are a number of tutorials on the subject that would be more thorough than what you could get ad hoc here on LQ.

worm5252 02-11-2010 11:10 PM

I have 2 hard drives in my box running mdadm RAID 1. I also use Debian Lenny. The easiest way to do it is from the disk partitioner during the install.

When I did it this is what I did.
1.) When I got to the disk partitioner I said I want to manually partition the disk.
2.) I selected the first hard drive and created a new partition table
3.) I created a new partition that was 1GB. I then specified to use the partition as a Physical Volume for RAID.
4.) The partition in step 3 was to be used for /boot. I repeated step 3 to create partitions for / and /home. For me that was 500GB and 993GB respectively.
5.) I then used the remaining 6GB of the hard drive to create a swap partition.
6.) Repeat steps 1-5 for the second hard disk.
7.) After you have partitioned both disk to have a swap partition and all the Physical volumes for RAID you will see a menu option at the very top of the disk partitioner labeled 'Configure Software RAID'. Select that Option.
8.) Next you are asked to write changed to disk and configure RAID. Select Yes
9.) At the next screen select 'Create MD Device'
10.) Next choose RAID 1
11.) Next enter 2 for the number of drives and select Continue
12.) I don't have a spare hard drive in this system so I entered 0 for spare devices.
13.) Next you select the partitions you want to be members of /dev/MD0. For me I selected /dev/sda1 and /dev/sdb1
14.) Repeat steps 9-13 for all the partitions you created. In my case I created MD0(/boot), MD1(/), and MD2(/home)Do Not create a MD device for your swap partitions or else you will constantly get errors about a degraded array.
15.) When you are done creating all of your MD arrays and adding disk partitions to them you can go back to the main menu of the disk partitioner. You will now see RAID Device# 0 and RAID Device# 1. Each RAID Device will show the partitions of your MD arrays you created. you can then select each on and specify to use ext3, ext4, ReiserFS, etc. and what the mount point is just like you would if it was a hard drive. For me RAID Device# 0 was /boot, RAID Device# 1 was /, and RAID Device# 2 was /home.
16.)Once all of the RAID Devices are configures select 'Finish Partitioning and write changes to disk'
17.) Select yes and watch it do it's thing.
18.) Finish the rest of the install like normal

caio2710 02-12-2010 03:22 PM

Thank you.
Thank you very much, worm5252. My RAID level 1 at root partition is finally done.

worm5252 02-12-2010 03:53 PM

No Problem Buddy.

Quakeboy02 02-12-2010 05:12 PM

I've got a question for you, worm5252. What about grub? Won't he have to manually install it on the second disk of the array before that disk will be bootable, or does the Debian grub installer do that now?

worm5252 02-12-2010 05:36 PM

Debian Installer Should do it for him. Easy wat to find out is to change /boot/grub/menu.lst to have root=/dev/sdb1 instead of /dev/md# and then reboot

Quakeboy02 02-12-2010 06:02 PM

No, that won't do it. That doesn't check to see whether the grub bootloader is on sector zero of the second disk. That only checks to see if the grub on disk0 can read the menu.lst on disk0 and then boot from disk1.

To actually check it, you need to swap the disk cables.

jlinkels 02-12-2010 08:38 PM

This is the best tutorial I have read on setting up a bootable RAID1 in Debian.

Most of the steps are not needed anymore because RAID is alread installed. But it proides useful other information as well.


worm5252 02-12-2010 09:56 PM


Originally Posted by Quakeboy02 (Post 3861991)
No, that won't do it. That doesn't check to see whether the grub bootloader is on sector zero of the second disk. That only checks to see if the grub on disk0 can read the menu.lst on disk0 and then boot from disk1.

To actually check it, you need to swap the disk cables.

Well if it isn't installed it can be done easily enough by running grub, selecting the sdb and the running setup. It is like 3 commands to do it and reading the man pages can tell you how.

All times are GMT -5. The time now is 11:27 AM.