How To Create The Raid Level 1 Mirroring In Red hat using Madam command

Using fdisk command first creates three partitions, Change the Partition type into Linux Raid Auto.For create the File system Partition refer the Below link
HOW TO CREATE THE FILE SYSTEM PARTITION
Linux raid auto detect and there code is fd.
/dev/hda10 28569 28570 16033+ fd Linux raid autodetect
/dev/hda11 27549 27550 16033+ fd Linux raid autodetect
/dev/hda12 27551 27552 16033+ fd Linux raid autodetect
Using mdadm command create md device array with partition /dev/hda10,/dev/hda11,/dev/hda12
[root@redhat ~]# mdadm -C /dev/md0 -l1 -n2 -x1 /dev/hda{10,11,12}
-C(Capital) Create New array of disk
-l Level Of Raid Concept
Level 0 for stripe,
Level 1 for mirror,
-n for no of Disk
-x no of spare device
How to create the Rail Level 1 Mirroring In Red hat Rhel5
mdadm: /dev/hda11 appears to contain an ext2fs file system
Size=8193116K mtime=Fri Apr 23 17:29:34 2010
Continue creating array? y
mdadm: array /dev/md0 started.
mdadm command refer to the manage the md devices

Check whether you create the md device array property or not.
[root@redhat ~]# mdadm -D /dev/md0
-D For display details of md devices
/dev/md0:
Version : 0.90
Creation Time : Thu May 13 17:27:54 2010
Raid Level : raid1
Array Size : 15936 (15.57 MiB 16.32 MB)
Used Dev Size : 15936 (15.57 MiB 16.32 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 13 17:28:03 2010
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
UUID : 50f7872e:d946e4f8:6df07c37:ff407748
Events : 0.2
Number Major Minor RaidDevice State
0 3 10 0 active sync /dev/hda10
1 3 11 1 active sync /dev/hda11

2 3 12 - spare /dev/hda12
Here /dev/hda10 and /dev/hda11 are the main device
/dev/hda12 is the spare device

Create The File System for md Device
[root@redhat ~]# mkfs.ext3 /dev/md0

Mount The MD Device
[root@redhat ~]# mount /dev/md0 /mnt
Using mount check whether the md files system mounted perfectly.
[root@redhat ~]# mount
/dev/md0 on /mnt type ext3 (rw)

[root@redhat ~]# cd /mnt/
Create the file
[root@redhat mnt]# touch file{1..10}

[root@redhat mnt]# ls
file1 file2 file4 file6 file8 lost+found
file10 file3 file5 file7 file9

using –f option Fail or make fault the hda10 device

[root@redhat ~]# mdadm -f /dev/md0 /dev/hda10
mdadm: set /dev/hda10 faulty in /dev/md0
-r remove list device
-f for fail the device

Then Display the Md Device Status
[root@redhat ~]# mdadm -D /dev/md0
Number Major Minor RaidDevice State
0 3 12 0 active sync /dev/hda12
1 3 11 1 active sync /dev/hda11
2 3 10 - faulty spare /dev/hda10
These status shows
/dev/hda10 is fault or fail , Remaining Two are active.
-S command stops the md device
[root@redhat ~]# mdadm -S /dev/md0
mdadm: stopped /dev/md0
Finally check the two devices whether the both partition has the files
[root@redhat ~]# mount /dev/hda11 /mnt
[root@redhat ~]# cd /mnt/
[root@redhat mnt]# ls
file1 file2 file4 file6 file8 lost+found
file10 file3 file5 file7 file9

[root@redhat ~]# mount /dev/hda12 /dev/
[root@redhat etc]# cd
[root@redhat ~]# cd /dev/
[root@redhat dev]# ls
file1 file2 file4 file6 file8 initctl
file10 file3 file5 file7 file9 lost+found
Files are present here so we can confirm RAID Level 1 Mirroring Performed successfully.

Raid Redundancy Array of Independent Disk
also known as Redundancy Array of Inexpensive Disk
Raid mirroring it will need at least two disk partitions.
Because if one partition fail another one partition automatically take the backup of the content. Spare device it will be replace if any one of the devices is fail.

Related post