Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux/Centos7RAID disk Array and Array Card

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Linux/Centos7RAID disk array and array card 1, RAID concept?

RAID-- redundant Array of Independent disks (Redundant Array of Independent Disks) was originally called redundant array of cheap disks. The basic idea of RAID is to combine multiple disks with small capacity and relatively low cost, so as to obtain the same capacity, performance and reliability as expensive large-capacity disks at lower cost. With the continuous reduction in the cost and price of disks, RAID can use most of the disks, "cheap" has become meaningless. So the RAID Advisory Committee uses "independent" instead of "cheap".

Second, why do you need RAID?

At present, RAID0, RAID1, RAID5 and RAID6 are mostly used in the types of RAID. The original intention of RAID is to provide high-end storage functions and redundant data security for large servers, but RAID0 obviously does not meet this requirement, because RAID0 is to greatly improve the efficiency of data reading and writing and the utilization of hard disks, so its principle is to write information to multiple disks at the same time, but it does not guarantee the security and reliability of the data. It is suitable for scenarios where only high reading and writing ability is needed, and the latter type has significantly improved and enhanced the security and reliability of the data.

RAID1-- image replication uses two or more disks (usually even blocks) for reading and writing, writing information to one disk, and copying one copy to another disk, thus ensuring reliable reading and writing of data. The two do not affect each other, but the utilization rate is only half of the original resources, so it is more reliable but resource-consuming.

To put it bluntly, RAID0 is only about speed, while RAID1 is about security. On the other hand, RAID5 is composed of three disks, which relies on the algorithm for parity error checking to ensure the reliability of the data while taking into account the disk utilization. It allows a disk to hang up, but there can be no more disk damage in the time period of repairing and rebuilding the data, otherwise the data will still be lost.

RAID6 carries out double check based on RAID5 to ensure that the data will not be lost in the case of two disks hanging. However, its read and write performance is relatively low, especially when the disk is damaged, the read and write speed will decline sharply, and the price is more expensive than others.

3. The operation flow of soft RAID configuration experiment first converts the partition type to fd (if the disk has been added) manages the mount of RAID disk format file format

The following experiments are done to configure RAID0:

[root@lokott ~] # lsblk / / View disk profile NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 40G 0 disk sda1 8:1 06G 0 part / boot ├─ sda2 8:2 020G 0 part / ├─ sda3 8:3 0 4G 0 part [SWAP] ├─ sda4 8:4 0 1K 0 part └─ Sda5 8:5 0 10G 0 part / homesdb 8:16 020G 0 disk sdc 8:32 020G 0 disk sdd 8:48 020G 0 disk sde 8:64 020G 0 disk sr0 11:0 14.2G 0 rom / run/media/root/CentOS 7 x86partition 64 [root@lokott ~] # fdisk / dev/sdb / set b disk partition format to fd Welcome to fdisk (util-linux 2.23.2). The changes remain in memory until you decide to write them to disk. Think twice before using the write command. Device does not contain a recognized partition table uses the disk identifier 0x363a740e to create a new DOS disk label. Command (enter m for help): nPartition type: P primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response p partition number (1-4, default 1): start sector (2048-41943039, default is 2048): the default value 2048Last sector will be used, + sector or + size {KMagg G} (2048-41943039, default is 41943039): will use the default value 41943039 partition 1 has been set to Linux type The size is set to 20 GiB command (enter m for help): t has selected partition 1Hex code (enter L to list all codes): fd has changed the type of partition "Linux" to "Linux raid autodetect" command (enter m for help): wThe partition table has been altered calling ioctl () to re-read partition table. Synchronizing disks. [root@lokott ~] # fdisk / dev/sdc Welcome to fdisk (util-linux 2.23.2). The changes remain in memory until you decide to write them to disk. Think twice before using the write command. Device does not contain a recognized partition table uses the disk identifier 0x1d0b68fc to create a new DOS disk label. Command (enter m for help): nPartition type: P primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response p partition number (1-4, default 1): start sector (2048-41943039, default is 2048): the default value 2048Last sector will be used, + sector or + size {KMagg G} (2048-41943039, default is 41943039): will use the default value 41943039 partition 1 has been set to Linux type The size is set to 20 GiB command (enter m for help): t has selected partition 1Hex code (enter L to list all codes): fd has changed the type of partition "Linux" to "Linux raid autodetect" command (enter m for help): wThe partition table has been altered calling ioctl () to re-read partition table. Synchronizing disks. / / check whether the partition is correct [root@lokott ~] # fdisk-l / dev/sd [bMurc] disk / dev/sdb:21.5 GB, 21474836480 bytes 41943040 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I size (min / best): 512byte / 512byte disk label type: dos disk identifier: 0x363a740e device Boot Start End Blocks Id System/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect disk / dev/sdc:21.5 GB, 21474836480 bytes 41943040 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I size (min / best): 512byte / 512byte disk label type: dos disk identifier: 0x1d0b68fc device Boot Start End Blocks Id System/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect [root@lokott ~] # mdadm-C-v / dev/md0-10-N2 / dev/sd [bMurc] / / mdadm command for RAID disk management mdadm: chunk size defaults to 512K / / md0 is the device name of the self-selected RAID0 -l is level,0 means RAID0mdadm: partition table exists on / dev/sdb / / 1 means RAID1,5 means RAID5,-n means how many disks are needed, followed by mdadm: partition table exists on / dev/sdb but will be lost or / / is the number of disks meaningless after creating arraymdadm: partition table exists on / dev/sdcmdadm: partition table exists on / dev/sdc but will be lost or meaningless after creating arrayContinue creating array? Ymdadm: Defaulting to version 1.2 metadatamdadm: array / dev/md0 started. [root@lokott ~] # lsblk / dev/md0 / / View the summary information is indeed RAID0NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTmd0 9:0 040G 0 raid0 [root@lokott ~] # mkfs-t xfs / dev/md0meta-data=/dev/md0 isize=512 agcount=16, agsize=654720 blks = sectsz=512 attr=2 Projid32bit=1 = crc=1 finobt=0, sparse=0data = bsize=4096 blocks=10475520, imaxpct=25 = sunit=128 swidth=256 blksnaming = version 2 bsize=4096 ascii-ci=0 ftype=1log = internal log bsize=4096 blocks=5120, version=2 = sectsz=512 sunit=8 blks, lazy-count=1realtime = none extsz=4096 blocks=0 Rtextents=0 [root@lokott ~] # mount / dev/md0 / mnt [root@lokott ~] # df-hT File system Type capacity available available mount point / dev/sda2 xfs 20G 4.4G 16G 22% / devtmpfs devtmpfs 474M 0474m 0% / devtmpfs tmpfs 489m 0% / dev/shmtmpfs tmpfs 489m 7 .1m 482m 2% / runtmpfs tmpfs 489M 0 489m 0 / sys/fs/cgroup/dev/sda5 xfs 10G 37M 10G 1% / home/dev/sda1 xfs 6.0G 158M 5.9G 3% / boottmpfs tmpfs 98M 4.0K 98m 1% / run/user/42tmpfs tmpfs 98M 20K 98m 1% / run/user/0 / dev/sr0 iso9660 4.3G 4.3G 0% / run/media/root/CentOS 7 x86_64/dev/md0 xfs 40G 33m 40G 1% / mnt 4, Summary

In fact, the configuration of soft RAID disk array is relatively simple, and the steps for other types of RAID configuration are the same, of course, you can also set backup, that is, add-xn (n represents the number of spare disks) at the end of the mdadm command, and then add the device name, which is mainly the setting operation of soft RAID.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report