The first letters of RAID (Redundant Array Of "Redundant Array Of Independent Disks (previously referred to as Redundant Array of INEXPENSIVE DISKS). To improve performance and reliability, data and information for error correction are stored in a data storage method for two or more hard drives, respectively. Disk arrays are managed by array management software and control error correction. RAID is usually used for web servers. Disk array profile for / etc / raidtab
RAIDDEV / DEV / MD0 // Specify the device name of the disk array RAID-level linear // Specify that the linear mode NR-RAID-Disks 2 // This array consists of 2 hard drives CHUNK-SIZE 32 // , The size of each write block Persistent-SuperBlock 1 // Set whether the superblockdevice / dev / hdb1 // of the disk is written to the actual situation, specify the first hard disk partition name RAID-DISK 0 // Setting the above partition is this The first // hard disk (number "0" started by the array) Device / dev / hdc1 // specifies the second hard disk partition name RAID-DISK 1 // Setting the above partition is used in this array. After the first // hard disk (number "0" started to create a configuration file, execute the following command #MKRAID / DEV / MD0 to perform the steps, have created the disk array, then start, the system will start this Array. Next, you can format and mount this array as the general hard disk partition. # Mke2fs -j / dev / md0 // Format this hard disk partition # mount -t ext3 / dev / md0 / mnt / raid forcibly Initialization Disk Array #MKRAID -REALLY-Force / DEV / MD0
After the mount is completed, you can access this directory for the use of disk arrays. Of course, you can also modify the / etc / fstab configuration file, so that the system automatically mounts this disk array. In addition to the mke2fs command There is also RAIDSTOP (the directory that needs to be unloaded first) and RAIDSTART. You can also view the status record file of the / proc / mdstat array.
Create a RAID-5 disk array
RAIDDEV / DEV / MD0 // Specify the device name of the disk array RAID-Level 5 // Specifies the use of the linear mode NR-RAID-Disks 3 // This array consists of two hard drives NR-SPARE-Disks 1 // This array Number of spare hard drives CHUNK-SIZE 32 // When data is written, the size of each write block Persistent-Superblock 1 // Set whether the SUPERBLOCKPARITY-ALGORITHM LEFT-SYMMETRIC / / specify which algorithm calculates the same school The code DEVICE / DEV / HDB1 // According to the actual situation, specify the first hard disk partition name RAID-DISK 0 // Set the above partitioned the first // hard disk used by this array (number started by "0" Device / dev / hdc1 // According to the actual situation, specify the second hard disk partition name raid-disk 1 // Set the above partition is the first // hard disk used by this array (the number is started by "0" Device / dev / HDD1RAID-DISK 2
DEVICE / DEV / HDA6 // Alternate Hard Disk Partition Name SPARE-Disk 0 // Specify the spare hard disk is the first standby hard disk used by this array (number starts from "0")
1, fault tolerance ability test
Shutdown, disconnect the HDC hard disk, restart, then RAID-5 arrays can still be enabled, and everything is normal. You can find that only 2 hard drives enabled by viewing the / proc / mdstat status record file. If there is a failure of more than two hard drives, the array cannot be started, and the data cannot be recovered.
2, support spare hard drive
Modify the configuration file, execute the RAIDSTOP and MKRAID commands, stop the array in the execution, and reinitialize the array. When initialization, the system will synchronize all hard drives in the background, and do not restart. After setting up the standby hard drive, if one of the hard disk is faulty, the system will automatically enable the standby hard disk, and use the data he run, rebuild this alternate hard disk data to ensure data security. 3, spatial utilization analysis
This mode uses a hard disk capacity to store the same bore check code, so the data waste rate is less than Linear and RAID-0. In the case where the standby hard disk is not used, if the RAID-5 array is composed of N hard disks, and the capacity of each hard disk is S, the capacity of this array is (N-1) XS
4, read and write performance analysis
In this way, since the read and write data is cut into a cell, the ideally access rate can become n-1 times due to the read and write data from the N-1 hard disk. But in fact, since the system resource must be consumed on the boreal check code, such a high transmission efficiency will not be achieved.