Server RAID and configuration combat

1. RAID (Redundent Array of Inexpensive Disk): Redundant Array of Inexpensive Disks.
Idea: Combine multiple cheap small disks together to form a disk group, so that the performance can reach a huge capacity and expensive disk.
2. After purchasing the server, do RAID first, then do the system, do pv, vg, lv, (root must get it out)

3. RAID levels
0 to 6 levels, as well as combination models, such as 1 0, 0 1, RAID 5 is commonly used, RAID 1 0 expensive
*
RAid0 (striped mode): Disperse access to continuous data, multiple disks are executed in parallel. This has good read and write performance and fast speed, but it is not safe and reliable.
*
RAID1 (mirroring mode): an even number of hard disks are required, one for data storage and one for backup. The spare tire hard drive can be automatically replaced after a hard drive goes down. Reliable but a waste of resources.
*
RAID5: Combine a large number of physical disks and still retain some redundancy. At least three hard disks are required, and the disk space is (N-1)*S

         轮巡存放校验数据,允许一块硬盘损坏,根据校验找回数据。
* 

RAID4: Similar to RAID5, but the parity data is stored on one hard disk.
*
RAID6: Similar to RAID5, but each time data is stored, two parity data are stored in a round robin. (At least four hard disks are required)
*
RAID1 0: RAID1+RAID0 (used in financial industries such as state-owned enterprises and banks, N>=4)

Insert picture description here
Insert picture description here
Insert picture description here
4. RAID card: Array card, a board that realizes RAID function.

5. Configure the RAID
tool: madam (multi disk admin)
-C: create RAID, for example -C /dev/md5
-A: load an existing array
-S: stop the RAID device
-D: output detailed information about the specified RAID
-s: Scan configuration file
-l: set the RAID level
-n: specify the number of active disks
-x: specify the number of spare disks
-G: change the size of the array
-v: display details
-a: mount the disk
-r: remove the disk
-f: change Disk is set to fail

6. Check the CentOS system version: cat /etc/centos-relase or cat /etc/redhat-release

7. Create RAID specific code
ll /dev/sd*
fdisk /dev/sdb (/sdc,/sdd,/sde)
Create primary partition (p), modify id to fd(t)
ls /dev/sd*
mdadm -Cv / dev / md5 -l5 -n3 -x1 / dev / sd [be] # create
mdadm -D -s or cat / proc / mdstat # View
mkfs.ext4 / dev / md5 # format
mkdir / aaa
Mount / dev / MD5 /aaa #Mount
vim /etc/fstab #Auto mount
Add /dev/md5 /aaa ext4 defaults 0 0

mdadm -D -s> /etc/mdadm.conf
vim /etc/mdadm.conf or sed -i'ls/$/auto=yes/' /etc/mdadm.conf #Create RAID configuration file
and add auto=yes after the line
Save and exit

8. Simulate hard disk damage
mdadm /dev/md5 -f /dev/sdb1 #Set disk failure
cat /proc/mdstat
cat /proc/mdstat
cat /proc/mdstat
mdadm /dev/md5 -r /dev/sdb1 #remove Disk
mdadm /dev/md5 -a /dev/sdb1 #Mount disk
cat/proc/mdstat

9. Disk stretch
fdisk /dev/sdf
mdadm -G /dev/md5 -n 4
cat /proc/mdstat
10. Delete RAID device
umount /dev/md5 #Unmount disk
mdadm -S /dev/md5 #Disable disk
vim /etc/fstab (delete the line of /dev/md5)
rm -rf /etc/mdadm.conf #delete the configuration file

Create pv, vg, lv delete method;
umount /aaa
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_39109226/article/details/109342899