The raid software array technology used by large and small factories must be learned!

Time:2021-7-26

1、 Introduction to common RAID

The full name of disk array is (redundant arrays of inexpensive disk, RAID), which means independent redundant disk array in Chinese. Raid can integrate multiple smaller disks into a larger disk device through technology (software or hardware), and this larger disk function can not only store, but also have the function of data protection. Due to different levels selected by the whole raid, the integrated disk has different functions. The basic commonly used levels are as follows

RAID 0 (striped storage) – best performance

The raid software array technology used by large and small factories must be learned!

  • RAID 0 continuously divides data in bits or bytes and reads / writes to multiple disks in parallel, so it has a high data transmission rate, but it has no data redundancy;
  • RAID 0 only improves performance, does not guarantee the reliability of data, and the failure of one disk will affect all data;
  • RAID 0 cannot be used in situations requiring high data security.
RAID 1 (mirrored storage) – full backup

The raid software array technology used by large and small factories must be learned!

  • Realize data redundancy through disk data mirroring, and generate mutually backed up data on paired independent disks;
  • When the original data is busy, the data can be read directly from the mirror copy, so RAID 1 can improve the reading performance;
  • RAID 1 is the highest unit cost in disk array, but it provides high data security and availability. When a disk fails, the system can automatically switch to the mirror disk for reading and writing without reorganizing the failed data.
RAID 5 – balance between performance and data backup

The raid software array technology used by large and small factories must be learned!

  • N (n > = 3) disks form an array. One piece of data generates n-1 strips and one piece of verification data. A total of N pieces of data are circularly and evenly stored on N disks
  • N disks read and write at the same time, with high read performance, but due to the problem of verification mechanism, the write performance is relatively low;
  • (n-1) / N disk utilization;
  • High reliability, allowing one disk to be damaged without affecting all data.
Raid 6 – more powerful data backup

The raid software array technology used by large and small factories must be learned!

  • N (n > = 4) disks form an array, (n-2) n disk utilization;
  • Compared with RAID 5, raid 6 adds a second independent parity information block;
  • Two independent parity systems use different algorithms. Even if two disks fail at the same time, it will not affect the use of data;
  • Compared with RAID 5, it has greater “write loss”, so the write performance is poor.
RAID 1 + 0 (mirror first, then stripe)

The raid software array technology used by large and small factories must be learned!

  • After n (even number, n > = 4) disks are mirrored, they are combined into a RAID 0;
  • N / 2 disk utilization;
  • N / 2 disks are written at the same time, and N disks are read at the same time;
  • High performance and high reliability.
RAID 0 + 1 (striping first, mirroring later)

The raid software array technology used by large and small factories must be learned!

  • The read-write performance is the same as that of raid 10;
  • Security is lower than raid 10;
  • Use less.

2、 Advantages of disk array

The raid software array technology used by large and small factories must be learned!

3、 Hardware disk array

The raid software array technology used by large and small factories must be learned!

Disk array introduction

The so-called disk array completes the function of the disk array through the disk array card (shown in the above figure). There is a special chip on the disk array card to handle raid tasks, so it will be better in performance than in price. In many tasks (such as RAID5 parity value calculation), the disk array will not repeatedly consume the I / O bus of the original system, and its performance will be better in theory. In addition, the current medium and advanced disk array cards support hot plug, that is, they can replace damaged disks without shutdown, which is very easy to use in system recovery and data reliability!

Array card introduction
  • Array card is a board used to realize raid function
  • It is usually composed of a series of components such as I / O processor, hard disk controller, hard disk connector and cache
  • Different raid cards support different raid functions:
  • For example, raid0, RAID1, RAID5, RAID10, etc. are supported
  • Interface type of raid card:
  • IDE interface, SCSI interface, SATA interface and SAS interface
Array card cache
  • Cache is the place where the raid card exchanges data with the external bus. The raid card first transfers the data to the cache, and then the cache exchanges data with the external data bus.
  • The size and speed of cache are important factors directly related to the actual transmission speed of raid card.
  • Different raid cards are equipped with different memory capacities at the factory, generally ranging from a few megabytes to hundreds of megabytes.

Software disk array settings

Here is a case to explain the configuration steps in detail:

  • Add 4 SCSI hard disks for Linux server;
  • Use mdadm software package to build RAID5 disk array to improve the performance and reliability of disk storage.
Add 4 SCSI hard disks to Linux in VMWare

For specific steps, please refer to the third paragraph of this blog: disk management to detect and confirm the new hard disk

The raid software array technology used by large and small factories must be learned!

Check if the mdadm package is installed

Use RPM – Q mdadm to check, as shown in the figure below, which indicates that the mdadm software has been installed. If not, use Yum install – y mdadm to install.

The raid software array technology used by large and small factories must be learned!

New disk partition primary partition: type FD

Modify / dev / SDB, / dev / SDC, / dev / SDD, and / dev / SDE disks

The raid software array technology used by large and small factories must be learned!

The raid software array technology used by large and small factories must be learned!

The raid software array technology used by large and small factories must be learned!

The raid software array technology used by large and small factories must be learned!

Creating RAID 5 devices

The raid software array technology used by large and small factories must be learned!

#Format mdadm  - C  - v  / dev/md0  - a   yes  - l5  - n3  / dev/sd[bcd]1  - x1  / dev/sde1

The raid software array technology used by large and small factories must be learned!

View RAID disk details
#There are two ways to view raid creation progress:
[[email protected] ~]# cat /proc/mdstat 
[[email protected] ~]# mdadm -D /dev/md0 

#The creation process is dynamically displayed every 5 seconds
[[email protected] ~]# watch -n 5 'cat /proc/mdstat'

#Check whether a disk is raid protected
[[email protected] ~]# mdadm -E /dev/sdb1

There are two ways to view raid creation progress

The raid software array technology used by large and small factories must be learned!

Explanation of display content:

[[email protected] ~]# cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid5 sdd1[4] sde1[3](S) sdc1[1] sdb1[0]
      41908224 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

#MDO: indicates that RAID5 created later contains SDD1, SDE1, SDC1 and sdb1
#Where SDE1 (s) means backup
#Uuu in the fourth line: indicates that the first three hard disks are normal

Check whether the / dev / sdb1 disk has been raid.

The raid software array technology used by large and small factories must be learned!

You can also view it using mdadm – D / dev / md0.

The raid software array technology used by large and small factories must be learned!

Format and mount the created RAID5
#Format
[[email protected] ~]# mkfs -t xfs /dev/md0 
#Mount (non permanent)
[[email protected] ~]# mount /dev/md0 /opt/

The raid software array technology used by large and small factories must be learned!

Analog fault detection raid function

Enter the mount directory and create some files and documents

The raid software array technology used by large and small factories must be learned!

Simulate a disk failure and view the process of re creation.

The raid software array technology used by large and small factories must be learned!

Create related profiles

Create / etc / mdadm.conf configuration file to facilitate the management of soft RAID configuration, such as start, stop, etc.

Related commands:

[[email protected] opt]# echo 'DEVICE /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1' > /etc/mdadm.conf

[[email protected] opt]# mdadm --detail --scan >> /etc/mdadm.conf 

The raid software array technology used by large and small factories must be learned!

Stopping and starting raid

Other common options for the mdadm command:

-r: Remove device
-a: Add device
-S: Stop raid
-A: Start raid
mdadm  / dev/md0  - f  / dev/sdc1  —  Set the specified disk as failed
mdadm  / dev/md0  - r  / dev/sdc1  —  Remove specified disk
mdadm  / dev/md0  - a  / dev/sdc1  —  Add specified disk

Manually delete failed disks and add new disks

The raid software array technology used by large and small factories must be learned!

Stop and start raid

If you do not add / etc / mdadm and conf configuration files in step 7, you will not be able to start if the configuration files are not scanned after stopping.

mdadm -S /dev/md0
mdadm -As /dev/md0

#-s: Refer to find  / Configuration information in the etc / mdadm.conf file

The raid software array technology used by large and small factories must be learned!

Link:  https://blog.csdn.net/weixin_…
The raid software array technology used by large and small factories must be learned!

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]