Install RAID 1 in Fedora/Centos/RHEL

RAID 1 is usually implemented as mirroring; a drive has its data duplicated on two different drives using either a hardware RAID controller or software (generally via the operating system). If either drive fails, the other continues to function as a single drive until the failed drive is replaced. Conceptually simple, RAID 1 is popular for those who require fault tolerance and don’t need top-notch read performance. A variant of RAID 1 is duplexing, which duplicates the controller card as well as the drive, providing tolerance against failures of either a drive or a controller. It is much less commonly seen than straight mirroring.

Step 1,

insert Your installtion with CD/DVD/FTP/DHCP server or other methde

follow the normal instructions :

You see. we have 2 disk of 8 GB

we will create 3 normal partition /boot (100MB) swap and / (root partition)

Click on the RAID button and choose “Create a software RAID partition

In the file system chose :  Software RAID

do it now with the second drive. after this you will see this:

Now Click RAID and Create a RAID device.

Now For the swap partition . create normal Swap on the 2 drives , dont make it the RAID

Swap = normal RAM in this example is 1 GB

Now create the root Partition / with the rest of the free Drive. with RAID device md1 and Raid level. level 1

you will see something like this :)

Now your RAID in ready to use after your os installation , reboot  , if you get some grub issue like kernel panic or grub error 17 or other issue, is not a big problem .

reboot with your OS in rescue mode : “linux rescue”

In the command prompt set a new root and build the RAID array:

sh-4.0# chroot /mnt/sysimage

Check the statis of your RAID with

#cat /proc/mdstat

Personalities : [raid1]
md1 : active raid1 sdb3[1] sda3[0]
7060480 blocks [2/2] [UU]

md0 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

UU means both disks are live

Run the following command to “hotadd” and rebuild the array:

[root@raidtest ~]# mdadm /dev/md0 --add /dev/sda1
[root@raidtest ~]# mdadm /dev/md1 --add /dev/sda3 

This process might take some time – depends on the sizes of the partitions.

Now time to Configure the GRUB.

sh-4.0# grub

Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]

GRUB shell type the following commands to re-install the boot loader on both drives,

grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
 grub> device (hd1) /dev/sdb
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

You have new mail in /var/spool/mail/root

reboot and Test if everything is working good

Links :

  • Ken

    supports raid1

  • Rashid IqbaL

    This is very helpful article. I need the information about the RAID-1 configuration on running centos 5.3 system.


  • http://enteryoursiteURL... Scott

    Thank you for this how-to. It was very helpful setting up FC15 with a RAID1 application. I was having problems with the correct partitioning which this article answered it completely.

  • dan

    thanks a lot ! i have just configured my centos server ! I needed to setup raid 1 for my busines !!!! cheers

    daniel from Bogota colombia !