Monday 15 February 2016

Raid5 configuration using 3 disk

Configuring Raid 5 in 3 disk



Raid 5: Combines striping and parity. Data is written across all disks as in RAID 0, but parity data is also written to one of the disks. Should a hard drive failure occur, this parity data can be used to recover the data from the failed drive, including while the data is being accessed and the drive is still missing from the array.

Select the 3 disk and format the three disk in raid using fdisk command and update the changes to kernel using partprobe command.


Note: here I am creating new raid with name md0 and guessing that we have 3 raid disk with /dev/sda(1,2,3)


1. Creating RAID 5 


mdadm --create /dev/md0 --level=5 --raid-disk=3 /dev/sda1 /dev/sda2 /dev/sda3



2. Format the raid partition


mke2fs -j /dev/md0


3. Create a mount point for raid


mkdir /data


4.Mount the raid 


mount /dev/md0  /data


5. To permanently mount the raid devices, add the mount point in /etc/fstab at end of the file as below,


/dev/md0 /data ext3 defaults 0 0 



RAID MANAGEMENT IN LINUX



 To verify the active raid that we have created in previous step by


mdadm --detail /dev/md0


 To check the running status of raid devces


cat /proc/mdstat




RAID Failover


1.  assume that one hard disk(/dev/sda2) form raid device gets fail

mdadm /dev/md0 --fail /dev/sda2



2. To verify the raid device status 


mdadm --detail /dev/md0


and for run time check


cat /proc/mdstat


3. Remove faulty devices


mdadm /dev/md0 --remove /dev/sda2



4. Adding a new harddisk


Note: before adding the disk(/dev/sda4) to the raid, kindly format and add as raid partition using fdisk and partprobe command. then


mdadm /dev/md0 --add /dev/sd4






REMOVE RAID 


1. unmount raid partition


umount /data


2. stop the raid device


mdadm --stop /dev/md0


3. Remove the raid device


mdadm --remove /dev/md0



4. Remove the entry from /etc/fstab



5. to remove raid partition form hard disk


use fdisk command and and select disk partition and use "d" to delete and "w" to write the changes.













No comments:

Post a Comment