Tuesday, 19 July 2011

Raid 0 Creation in Linux

RAID : A Redundant Array of Independent Disks (RAID) is a series of disks that can save our data.
    -> It
allows an administrator to form an array of several hard drives into one logical drive recognized as one drive by the operating system.
    ->
It also spreads the data stored over the array of drives to decrease disk access time
    ->
The data redundancy can be used to recover datashould one of the hard drives in the array crash

RAID 0 (
Striping) :   data is written across all hard drives in the array

Example: Hard disks are categorized in Block devices.because it will read/write data in terms of blocks

We will write A, B, C, D, E and F – blocks data to a Raid array ,then Raid 0 how it will receive is

RAID LEVEL 0




Requirements :
-> 2 hard disk (2 partitions should use)

Advantages:
        ->fast  I/O operations
        ->
the size of the logical RAID drive is equal to the size of all the hard drives in the array.

Disadvantages:
        ->There is no redundancy, recovering data from a hard drive crash is not possible


Implementation:

i) Create a Raid Partiotions
 mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdb2

ii) Create file system on it
mke2fs -j /dev/md0

iii) Mount it
 mount /dev/md0 /raid
or
Update  /etc/fstab with following line
/dev/md0 /raid ext3 defaults 1 2 


Monitor :

1)sudo nohup mdadm --monitor /dev/md0 --daemonize --delay=3600 --alert /raid/monitor.sh &  
     
/raid/monitor.sh      
      $output=sudo mdadm --detail --scan | grep -i "raid0"           
      `sudo echo $output > /etc/mdadm/mdadm.conf`;

2)Check the development of the RAID.
cat /proc/mdstat

3)
tail /var/log/messages


4)To Remove a Faulty raid array element
mdadm /dev/md0 --remove /dev/sdb2

5)To add new disk to raid array element
mdadm /dev/md0 --add /dev/sdb3

No comments:

Post a Comment