Thursday, 28 November 2019

How to Configure Software RAID 5 (Distributed Parity) on CentOS 7




RAID (Redundant Array of Independent \Inexpensive Disk) is a data storage technology that combines multiple physical disk drives into a single logical volume to provide data redundancy and performance which vary depending on the RAID levels. mdadm (multiple devices admin) is a widely used tool to manage RAID on most of the Linux distributions.

This article describes How to Configure Software RAID 5 (Distributed Parity) on CentOS7. Three additional hard disk partitions (sdb1, sdc1 and sdd1 Linux raid autodetect) which use in RAID 5 Configuration:

[root@linuxcnf ~]# fdisk -l /dev/sdb /dev/sdc

Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 sectors
…………………..
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    16777215     8387584   fd  Linux raid autodetect

Disk /dev/sdc: 8589 MB, 8589934592 bytes, 16777216 sectors
…………………..
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    16777215     8387584   fd  Linux raid autodetect

Disk /dev/sdd: 8589 MB, 8589934592 bytes, 16777216 sectors
…………………..
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    16777215     8387584   fd  Linux raid autodetect
[root@linuxcnf ~]#

Step 1. mdadm Package Installation: mdadm tool is not available in CentOS7 minimal installation. Run the following command to install mdadm packages and its dependencies:

[root@linuxcnf ~]# yum install mdadm -y
Loaded plugins: fastestmirror
…………………..
Installed:
  mdadm.x86_64 0:4.1-1.el7

Dependency Installed:
  libreport-filesystem.x86_64 0:2.1.11-43.el7.centos

Complete!
[root@linuxcnf ~]#

Step 2. Create RAID 5 (Distributed Parity): Run the following command to create RAID 5 (Distributed Parity) with two hard disk partitions:

[root@linuxcnf ~]# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 8382464K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@linuxcnf ~]#

Step 3. Verify RAID 5 Status: Run the following command to verify RAID 5 (Distributed Parity) creation. It is syncing all the devices and it is in progress:

[root@linuxcnf ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[3] sdc1[1] sdb1[0]
      16764928 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
      [>....................]  recovery =  1.9% (159744/8382464) finish=5.1min speed=26624K/sec

unused devices: <none>
[root@linuxcnf ~]#

Once re sync process is completed it shown as below:

[root@linuxcnf ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[3] sdc1[1] sdb1[0]
      16764928 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>
[root@linuxcnf ~]#

Done!!! RAID 5 (Distributed Parity) is created successfully with two hard disks and RAID 5 (Distributed Parity) partition /dev/md0 is ready to create file system for use.

No comments:

Post a comment