Thursday, 28 November 2019

How to Configure Software RAID 1 (Mirroring) 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 1 (Mirroring) on CentOS7. Two additional hard disk partitions (sdb1 and sdc1 Linux raid autodetect) which use in RAID 1 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
[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 1: Run the following command to create RAID 1 with two hard disk partitions:

[root@linuxcnf ~]# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: size set to 8382464K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@linuxcnf ~]#

Step 3. Verify RAID 1 Status: Run the following command to verify RAID 1 creation. It is re syncing both the hard disk partitions and it is in progress:

[root@linuxcnf ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
      8382464 blocks super 1.2 [2/2] [UU]
      [>....................]  resync =  2.8% (241792/8382464) finish=2.8min speed=48358K/sec

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

Once re sync process is completed it shown as below:

[root@linuxcnf ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
      8382464 blocks super 1.2 [2/2] [UU]

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

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

No comments:

Post a comment