18 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

How To Set Up A Software RAID-1 On Centos8

RAID introduces: (Redundant Array of Inexpensive Disks or Drives, or Redundant Array of Independent Disks) is a data storage virtualization technology that combines multiple physical disk drive components into one or more logical units for the purposes of data redundancy, performance improvement, or both. This was in contrast to the previous concept of highly reliable mainframe disk drives referred to as “single large expensive disk” (SLED).

Data is distributed across the drives in one of several ways, referred to as RAID levels, depending on the required level of and performance. The different schemes, or data distribution layouts, are named by the word “RAID” followed by a number, for example, RAID 0 or RAID 1. Each scheme, or RAID level, provides a different balance among the key goals: reliabilityavailabilityperformance, and capacity. RAID levels greater than RAID 0 provide protection against unrecoverable sector read errors, as well as against failures of whole physical drives.——[RAID.wikipedia]

The test environment

  • CentOS 8.0 virtual machine
  • Add two hard disks
  • The installation for mdadm

raid-1 operating steps

  • Use LSBLK to view the current hard disk partition
lsblk
disk partition info

You can see that sdb and sdc are not in use

  • partition for sdb and sdc
- Advertisement -

Because RAID requires the same size of each hard disk, sdb and sdc are partitioned respectively, and each hard disk is partitioned into a 16G partition, and Hex code is modified as fd

fdisk /dev/sdc
partition for sdc
partition for sdc

Other hard disk partition process omitted, partition after as follows:

disk info
  • installation mdadm
yum install madadm
  • Create a RAID-1

sdb1, sdc1 form a group of raid-1, RAID device named /dev/md0

mdadm -C /dev/md0 -a yes -l 1 -n 2 /dev/sd{c1,b1}
raid-1
build raid-1

Check the progress:

cat /proc.mdstat 
progress

View RAID information:

mdadm -D /dev/md0
RAID information

Here we create a RAID1 disk array from mdadm

  • Create the md0 profile
echo DEVICE /dev/sd{b,c}1 >> /etc/mdadm.conf
mdadm -Evs >> /etc/mdadm.con 
  • Format & create directory and mount
mkfs.xfs /dev/md0
mkdir    /raid1
mount    /dev/md0 /raid1
df       -h
mount disk

At this time we can go to /raid1 directory to store our files

  • Write the partition table and mount automatically at startup
echo "/dev/md0 /raid1 xfs defaults 0 0" >> /etc/fstab 

Conclusion

Save A file to display of RAID 1, RAID will cut into A1, A2, A3, branch of two pieces of written to disk, can make the disk write speed slightly down, because this way is written to disk, one of the hard disk is broken, another have the same backup hard disk, so the RAID 1 is redundant support, but the cost is quite high, also only 1/2 of the disk space can be used

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article