Translate

Sunday, 10 February 2013

Software RAID in Linux

Software RAID in Linux

For configuration software RAID , First we need to undrstand what is raid, why its use or require.

Here we are not goining in dept, we are covering the importants points to know raid and understand it.

RAID stands for Redundant Array of Inexpensive Disks or Independent Disks ..

RAID use to give redunsy or fault tolerance by redundant data on multiple disks

main typeof RAID

RAID 0 :  Disk Striping using for Performance
RAID 1 : Mirroring using for Fault Tolerance (minimum two disks require one disk is mirror of other)
.
.
.
RAID5 : striping with distributed parity using for Speed and Fault Tolerance (minimum three disks require)

we can use raid level as per our requirement or enviroment or need like we can use RAID (1+5) , here we are using both raid 1 and 5, we ca use raid 1 for our OS and raid 5 for our data.

Now come to praticle :-)

To Install Software RAID we require the following package

Package name : mdadm

#yum install mdadm -y                       (Hope u have learn how to install yum from previous blog :-)

Now create the required partition

#mdadm -C /dev/md0 -n3 /dev/sda11 /dev/sda12 /dev/sda13 -l5

mdadm : array /dev/md0 started

-C for create
-n3 for number of disk
-l5 for level of raid

more flags u can get from man mdadm command

To see the detail information of /dev/md0

#mdadm -D /dev/md0

To format the raid meta device

#mkfs.ext3 /dev/md0

Mount the partition

#mkdie /raid_dir
#mount /dev/md0 /raid_dir

#df -hT                                  (we can check by df command for its mounting status)

wright some content inside the raid partition

#cd /raid_dir
#cat > testfile
this is the test file

#ll
testfile

To add a new device as spare

#mdadm -a /dev/md0 /dev/sda14
#mdadm -D /dev/md0
#mdadm /dev/md0 -f /dev/sda12
mdadm: set /dev/sda12 faulty in /dev/md0

To see more information of /dev/md0
#mdadm -D /dev/md0

To remove the faulty device

#mdadm /dev/md0 -r /dev/sda12
mdadm: hot remove /dev/sda12

#mdadm -D /dev/md0

To stop the raid unmount the meta device.

#umount /dev/md0
#mdadm -S /dev/md0
mdadm:stoped /dev/md0

To activate or assemble the raid meta device

#mdadm -A /dev/md0 /dev/sda11 /dev/sda13 /dev/sda14
mdadm: /dev/md0 has been started with 3 devices.

#mdadm -D /dev/md0


This is all in software RAID in Linux. Hope you like this.Please comment and suggestion require for motivation and improvement.