Sunday, August 28, 2011

RAID example

RAID (Redundant Array of Inexpensive Disks)



Create 3 partitions for implementing RAID using fdisk command.



e.g. #fdisk /dev/hda



Press n to create the 3 new partitions each of 100Mb in size.



Press p to see the partition table.



Press t to change the partition id of all the three partitions created by you to fd (linux raid auto).



Press wq to save and exit from fdisk utility in linux.



#partprobe



Use fdisk -l to list the partition table.



Creating RAID



# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/hda6 /dev/hda7 /dev/hda8



Press y to create the arrays.



To see the details of raid use the following command: -



# cat /proc/mdstat



# mdadm --detail /dev/md0



Creating the file system for your RAID devices



#mkfs.ext3 /dev/md0



Mounting the RAID partition



#mkdir data



# mount /dev/md0 data



#df -h /root/data (Command is used to see the space allocation).



Crashing the raid devices



# mdadm --manage /dev/md0 --fail /dev/hda8



Removing raid devices



# mdadm --manage /dev/md0 --remove /dev/hda8





Adding raid devices



# mdadm --manage /dev/md0 --add /dev/hda8



View failed and working raid devices



# cat /proc/mdstat



# mdadm --detail /dev/md0



# tail /var/log/messages



To remove the RAID follow these steps: -



1) unmount the mounted directory where raid is mounted.

e.g. umount data

2) Stop the device

e.g. mdadm --stop /dev/md0

3) View the details of your raid level using following command: -

#cat /proc/mdstat

#mdadm --detail /dev/md0





see:- also http://aarklonlinuxinfo.blogspot.com/2010/03/lvm-raid.html























No comments:

Post a Comment