Create 4 disks of same size. scan the bus, run the fdisk -l command to view the newly created partitions
and follow the blog for the next steps.......
[root@RHEL5 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@RHEL5 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 382 3068383+ 83 Linux
/dev/sda2 383 1019 5116702+ 83 Linux
/dev/sda3 1020 1503 3887730 83 Linux
/dev/sda4 1504 2610 8891977+ 5 Extended
/dev/sda5 1504 1885 3068383+ 83 Linux
/dev/sda6 1886 2076 1534176 82 Linux swap / Solaris
/dev/sda7 2077 2203 1020096 83 Linux
/dev/sda8 2204 2241 305203+ 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
[root@RHEL5 ~]#
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 1048512K
mdadm: array /dev/md0 started.
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:13:51 2013
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 83% complete
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.1
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
3 8 48 2 spare rebuilding /dev/sdd
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:14:29 2013
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.2
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
------------------------------------------------------------
[root@RHEL5 ~]# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
[root@RHEL5 ~]# vgcreate lvm-raid /dev/md0
Volume group "lvm-raid" successfully created
------------------------------------------------------------
[root@RHEL5 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
lvm-raid 1 0 0 wz--n- 2.00G 2.00G
[root@RHEL5 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md0 lvm-raid lvm2 a- 2.00G 2.00G
------------------------------------------------------------
Free PE / Size 511 / 2.00 GB
[root@RHEL5 ~]# lvcreate -L 511 lvm-raid -n lvm0
/dev/cdrom: open failed: Read-only file system
Rounding up size to full physical extent 512.00 MB
Logical volume "lvm0" created
------------------------------------------------------------
[root@RHEL5 /]# mke2fs -j /dev/lvm-raid/lvm0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
64 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
------------------------------------------------------------
[root@RHEL5 /]# mount /dev/lvm-raid/lvm0 /data/
[root@RHEL5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2.9G 262M 2.5G 10% /
tmpfs 506M 0 506M 0% /dev/shm
/dev/sda8 289M 11M 264M 4% /home
/dev/sda2 4.8G 138M 4.4G 4% /opt
/dev/sda7 965M 18M 898M 2% /tmp
/dev/sda5 2.9G 2.2G 531M 81% /usr
/dev/sda3 3.6G 124M 3.3G 4% /var
/dev/mapper/lvm--raid-lvm0
496M 19M 452M 4% /data
------------------------------------------------------------
Take the /dev/sdb out of the raid array.
[root@RHEL5 /]# mdadm /dev/md0 -f /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0
[root@RHEL5 /]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:35:37 2013
State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.4
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
3 8 16 - faulty spare /dev/sdb
--------------------------------------------------------------
[root@RHEL5 /]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@RHEL5 /]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 382 3068383+ 83 Linux
/dev/sda2 383 1019 5116702+ 83 Linux
/dev/sda3 1020 1503 3887730 83 Linux
/dev/sda4 1504 2610 8891977+ 5 Extended
/dev/sda5 1504 1885 3068383+ 83 Linux
/dev/sda6 1886 2076 1534176 82 Linux swap / Solaris
/dev/sda7 2077 2203 1020096 83 Linux
/dev/sda8 2204 2241 305203+ 83 Linux
Disk /dev/md0: 2147 MB, 2147352576 bytes
2 heads, 4 sectors/track, 524256 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Noe lets add the newly created device in the array.
--------------------------------------------------------------
[root@RHEL5 /]# mdadm /dev/md0 -a /dev/sde
mdadm: added /dev/sde
See the output the device is seen:
[root@RHEL5 /]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:41:01 2013
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.6
Number Major Minor RaidDevice State
0 8 64 0 active sync /dev/sde
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
3 8 16 - faulty spare /dev/sdb
--------------------------------------------------------------
Thanks.