Razine
Infrastructure System Engineer

Configure External RAID on Ubuntu/Centos/RedHat

Introduction

RAID: Stands For Redundant Array Of Independent Disks (Hardware Raid) or  Redundant Array Of Inexpensive Disks (Software Raid) and that is technology that keeps data redundant to avoid data loss if any disk falls or is corrupted .

RAID Types ?

  • Hardware RAID : is a physical controller can create array of disks and configure any level of raid on that array 
  1.  Support Fast speed cache to synchronize with OS during writing with very large amount of data 
  1.  Platform independence not depending on state of OS if work or fall , data keeped away
  • Software RAID : is a software raid supported in  Windows or linux 
  1.  Easy to use 
  2.  Can be performed in physical or logical hard disks 

RAID Levels ? 

  • RAID 0 (Stripping) : can be performed in 2 disks at least 
  1. Fast Reading 
  2. Fast Writing
  3. Redundancy (Fault tolerance) none 
  • RAID 1 (Mirroring) : can be performed in two disks at least data can be kept if one disk fails.
  1. Good Reading
  2. Good Writing
  3. Redundancy (Fault tolerance) Excellent
  • RAID 5 (Strip With parity ) : can be performed in 3 disks at least to infinity or number of disks available ,data can be restored if one disk fail
  1. Good Reading 
  2. Good Writing
  3. Redundancy (Fault tolerance) Good 
  • RAID 6 (Strip With dual parity ) : can be performed in 4 disks at least to infinity or number of disks available,data can be restored if one disk fail
  1. Good Reading 
  2. Good Writing
  3. Redundancy (Fault tolerance) Good 
  • RAID 10 (RAID 0+ RAID 1 ) : can be performed in 4 disks at least to infinity or number of disks available, we merge raid 0 with raid 1 

Preferred to be even number of disks

  1. Fast Reading 
  2. Good Writing
  3. Redundancy (Fault tolerance) excellent

How To Create RAID ?

First You need to install the mdadm tool to manage and configure Software RAID. 

You can install it by following next steps : 

Open your terminal 

Write : 

   Debian\Ubuntu

sudo apt-get update -y
sudo apt install mdadm -y 

   RedHat\CentOs:

yum update 
sudo yum install mdadm

After Installation you need to decide which level of raid you want to configure in your disks depending on your environment and how data is important.

How To Create RAID 0 :

  • Open your terminal 
  • Then Write :  
mdadm --create /dev/md0 --level=0 --raid-devices=2  /dev/sdb   /dev/sdc 

     Hint:  –create : /dev/name of array

               –level= number of raid 

               –raid-devices= number of devices used to create raid 

  • Then Write : 
  watch cat /proc/mdstat 

 Hint: watch to repeat same command every 2 seconds to monitor the  raid creation process if failed or done

  • Then Write :
lsblk

   Hint:   to list your devices and knew what technology applied to your disks

How To Create RAID 1 :

  • Open your terminal 
  • Then Write :  
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc 

How To Create RAID 5 :

  • Open your terminal 
  • Then Write :  
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc  /dev/sdd

How To Create RAID 6 ?

  • Open your terminal 
  • Then Write :  
mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdb /dev/sdc  /dev/sdd /dev/sde

How To Create RAID 10 ?

  • Open your terminal 
  • Then Write :  
mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sdb /dev/sdc  /dev/sdd /dev/sde

Conclusion:

The article clarify the best way to configure all types of software raid on linux.

For more info use command : 

man mdadm

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x