Linux RAID

RAID : Redundant Array of Inexpensive Disk

RAID Types :

i) Software RAID

ii) Hardware RAID

RAID Levels :

a) RAID 0

- Striping

- 2 Devices

b) RAID 1

- Mirroring

- 2 Devices

c) RAID 5

- Striping with Parity

- 3 Devices

d) RAID 6

- Striping with Dual Parity

- 4 Devices

What is Software RAID?

1) Multiple Disk grouped together into array

2) mdadm - Provides the administration interface to software RAID

3) RAID Levels - 0,1,5,6

4) Spare disks add extra redundancy

5) Raid devices are named /dev/md0, /dev/md1, /dev/md2

Create and define RAID devices using mdadm

mdadm -C /dev/md0 -a yes -l 1 -n 2 -x1 elements

-C = Create

-a = If exist then continue

-l = Raid Level

-n = no of devices

-x = extra devices

elements = device name

Process To Create RAID5

1) fdisk -l

2) create 3 partition using fdisk

3) Now create the ID of the dist to fd(RAID)

4) Use t command to change disk ID

5) mdadm -C /dev/md0 -a yes -l 5 -n 3 -x 1 /dev/sdb{1,2,3,5}

6) Watch cat /proc/mdstat (To check the background process)

7) mdadm --detail /dev/md0

8) mke2fs -j /dev/md0 (To format the Disk)

9) mount /dev/md0 /data

10) df -h

To check RAID is working or not

Now fail one of the disk

1) mdadm /dev/md0 -f /dev/sdb3

2) watch cat /proc/mdstat (recovering the spare disk)

3) mdadm --detail /dev/md0

4) mdadm /dev/md0 --remove /dev/sdb3

5) mdadm --detail /dev/md0

6) fsck /dev/sdb3

7) mdadm /dev/md0 -a /dev/sdb3

8) mdadm --detail /dev/md0