# Configure the System RAID

Prerequisite:-

  • Centos 7 Machine
  • mdadm package installed
  • Two Data Volumes attached to the machine for performing the RAID

Steps to perform:-

  • First, check if the attached disks are available.

Note: Here we can create the partition using both inbuilt utility fdisk and Parted but for the demo, I have already taken the backup of the partition tables created manually using the above-mentioned utilities and here with the help of the sfdisk we will restore the partition table with correct label and sizes.

Partition Table files:-

Contents of the Partition files:-

  • Device /dev/nvme1n1
  • Device /dev/nvme2n1
  • Create 3 partitions in /dev/nvme1n1 device
  • Verify the partition info
  • Create 7 partitions in /dev/nvme2n1 with 3 as primary 1 as extended and 3 as logical
  • Verify the partition table info
  • Check for the mdadm utility is installed 👍
  • If not installed then run the below command 👇

Creating the Software RAID using mdadm.

  • Here we create a new device of RAID level 5 with 3 active devices and 3 spare devices for fault tolerance and backup.
  • Verify the creation of the new RAID device
  • Details of the device can also be obtained using -D flag or --detail

🟡 — — — — — — 🟡— — — — —OR — — — — — 🟡 — — — — 🟡

  • To make the configuration persistent to reboot we will create the mdadm.conf file. So now we will scan our device with -s or --scan_ with -v to get the output and redirect it into the configuration file
  • Create Mount point for a newly created array
  • Now we will create the filesystem on the array
  • Now we mount this array /dev/md0and can check it using df -h also, we will create a new directory inside this after mounting called backup and copy the, etc contents inside it
  • To make it persist any reboot we need to add this entry to our /etc/fstab file so, for it we need theUUID of the array, we created which we will get from the below command.
  • /etc/fstab Contents
  • Umount the mounted and try to read and mount the device array from fstab file

Managing Failover and Recovery of RAID Devices

  • Now here we will fail one device and observe the rebuild status of a spare device taking its place. Make sure we don't fail 2 devices at a time or we will lose the data
  • Now the rebuild process will start and spare devices takes place of the faulty drive
  • Similarly, we will replace all the active devices with the spare one’s as above
  • Remove the failed devices one by one or together from the array
  • Add the new spare devices one by one or together in the array and verify the same
  • Add this new information back to the main configuration /etc/mdadm.conf to make it persistent

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store