CentOS / Redhat: Create Software RAID 1 Array

Recently, I’ve added another 73GB SAS disk to my Linux server after the installation. I’ve 30GB empty partition on old hard disk. How do I convert old /dev/sda3 and new /dev/sdb1 (both 30GB) into RAID 1 to improve NFS server speed and reliability?

RAID devices are virtual devices created from two or more real block devices. Linux supports RAID1 and other levels. You need to have same size partition on both disks i.e. on second disk create partitions exactly the same size as those on the first disk, and set the type as fd (Linux raid autodetect). You need to use the following commands to create RAID 1.

WARNING! These examples may crash your computer or may result into data loss if not executed properly. These examples involves disk partition manipulation using the fdisk command and building (formatting) file systems using the mkfs.ext3 command. So make sure you backup all data before typing any one of the following command.

Step # 2: Create 37G Partitions For /dev/sdb

Type the following command:# fdisk /dev/sdb Sample outputs:

The number of cylinders for this disk is set to 8910.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):

To add a new partition, type n command followed by p command as follows:

This tutorial is great… I had also created two partition..such /dev/hda5 and /dev/hda6 and by this 2 partition make a raid partition /dev/md0 and mount this partition in /root/raid1 directory. At this time i created some files and folder in this directory where my raid partition mounted. But i want to see how my RAID1 is working. For that i try to mount my /dev/hda5 and /dev/hda6 partition in another two directory such as /root/part1 and /root/part2. But i am failed. show me /dev/hda5 and /dev/hda6 is already mounted or /root/part1 and /root//part2 is so busy.. what can i do now..pls help me… i want to see real scenario of RAID1

Thank you, great tutorial. I followed it and everything worked. But the transfer speed using the test from the “How Do I Test My RAID 1 Array Speed?” shows me the 10Mb/s. And it took 24 hours to create the raid1 with mdadm. I’m using eSATA pcmcia card with two 1Tb external esata drives. I don’t know if this is eSATA controller issue or the drives. How can I further test it?

Great how-to, thanks! Just made a variation of this on a CentOS 6.6 system which received 2 extra disks after OS installation. All was OK, but I was surprised that the /dev/md0 was later (by itself) renamed to /dev/md127 after reboot and thus the /etc/fstab entry didn’t work. Editing the file to update that fixed the issue.