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: reliability, availability, performance, 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
You can see that sdb and sdc are not in use
- partition for sdb and sdc
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
Other hard disk partition process omitted, partition after as follows:
- 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}
Check the progress:
cat /proc.mdstat
View RAID information:
mdadm -D /dev/md0
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
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