This article shows how to configure raid 1 mirroring into your linux server
you must have two hard drive installed on your linux server with the same capacity
You can listed them using the following command
fdisk –l
This will display your currently installed hard drive on your linux server
/dev/hda/
/dev/hdb/
Then you have to create a logical partition on both hard drives with same capacity
Following command willl create a new partition on your linux server , for first hard drive (/dev/hda)
fdisk /dev/hda
This will ask for primary or extended partition
Type e for extended partition
Next will ask for cylinder size of your partition , don’t change anything
Next will ask for actual space for your extended partition
Type +10000M
Type w for write partition table
Now you have to create a logical partition using the following command
fdisk /dev/hda
N for new partition
L for logical partition
Just enter with the default configuration (cylinder size)
Type the size of your logical partition +5000m
Type w for write partition table
Remember by default when you create a new partition linux uses partition id number 82 .
You have to change this partition id fd for raid configuration with the following command
fdisk /dev/hda
Type l for change partition id
This will ask you which partition id would you like to change type your partition number
For example 5
Type fd for raid partition id
Type w for write partition table
You have to complete the same procces on second hard drive
Now you can start your raid 1 configuration using the following command
But before do this please check mdadm rpm package is installed or not
You can check this using rpm –q mdadm
You can also install this package using the following command
Type rpm –ivh mdadm
Now run the following command to create raid array
Type mdadm –create /dev/md0 –level=1 /dev/hda5 /dev/hdb5
This will create a raid partition on your linux server
You can see the details using the following command
Type mdadm –detail /dev/md0
Now you have to format this partition to use them
Type mkfs –t ext3 /dev/md0
This will write ext3 file system on your raid partition
Then you have to mount this raid partition on some directory using
Type mount /dev/md0 /raid1
If one of the hard drive faild on raid 1 type the following command to remove them from raid1
Type mdadm /dev/md0 –f /dev/hda5 (to fail your harddrive in raid1 )
Type mdadm /dev/md0 –r /dev/hda5 ( to remove your hard drive from raid1 )
Now you can join a new hard drive create logical partition with same capacity & join into you raid1 partition using the following command
Type mdadm /dev/md0 –a /dev/hdc5
You can see raid1 will syncs the data with the new hard drive using
Type mdadm –detail /dev/md0
Let’s be straight-forward: no one like when things like this happen to them. So, I need to explain this quite upstanding affair