Implementing RAID-1

Here you will find the implementation of RAID level 1 (mirroring) with two different partition of same size on linux host.

First select 2 partition of equal size. If u have free space on your HDD u can create 2 new partition of same size using fdisk command, then run partprobe and create file system for newly created partition using mkfs.

Now install the mdadm package.
If you do not have md and raid1 module already loaded use modprobe to load it:
lsmod |grep raid1/md[to check whether they are loaded]

Load modules at boot time
No we need to make sure that raid kernel modules are loaded at the boot time.
echo raid1 >> /etc/modules
echo md >> /etc/modules
Load modules to the Kernel
modprobe raid1

modprobe md and again check with lsmod command.

N.B. The partition u just created need to be unmounted.

So your partitions are ready and raid1 and md modules also loaded on your kernel and make sure you have rsync installed on your system.

Then run the following command to create the raid device-

mdadm –create –verbose /dev/md0 –level=1 –raid-devices=2 /dev/sda10 /dev/sda11
Create a filesystem on RAID 1 Arrays
mkfs.xfs -f /dev/md0

Then mount the device
Edit mdadm.conf file
cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig
mdadm –detail –scan >> /etc/mdadm/mdadm.conf
Edit /etc/fstab

As we want to make our system to mount new RAID 1 arrays after reboot we need to edit /etc/fstab file.
/dev/md0 /disk-1 ext3 defaults 0 2
To see the current status of your RAID partition type the following command

mdadm –detail /dev/md0


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: