Linux disk array technology (i)--RAID0 creation

Source: Internet
Author: User
Tags disk usage

Disk array? Listen to the name on the tall, but on the tall things we generally do not understand Ah! So what exactly is a disk array, what the hell is this guy doing?

Disk array The role of raid,raid is to prevent sudden damage to the hard disk resulting in data loss of a redundant backup mechanism, white is to be able to save the hard disk when the data is not lost a technology.

There are two ways to create a raid: soft RAID (implemented via operating system software) and hard raid (Hardware array card)

RAID is commonly divided into the following categories:

⑴ RAID 0 "stripe mode": Requires at least two hard drives, in series mode. That is, the size of each piece of hard disk is the same. For example, our data volume is 2G, the first hard disk storage 1G, the second hard disk storage of the remaining 1G. This way, when one of the hard drives is damaged, the data is corrupted, so we don't usually use this in our work. The advantage is that disk utilization is 100%.


⑵ RAID 1 : mirrored volume, requires at least two hard drives, if our data is 1G, then the data stored on the first hard disk, and then copy one of the storage of the other hard disk to do hot standby, that is, two hard disk data is identical. Disk usage is 50%, and one of the disks is damaged without affecting the data.


⑶ RAID 5 : RAID 1 can be a backup, but read and write speed is not improved, if we are in the backup while also want to improve the read and write speed, then we use RAID 5, at least three hard drives required. Damage to only one hard drive does not result in data loss.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/8A/EE/wKiom1g_g4ziATiHAAFzLfq9fgA614.png "title=" Qq20161201095702.png "alt=" Wkiom1g_g4ziatihaafzlfq9fga614.png "/>

From the bottom line or the calculation, the principle of RAID 5 is this:

The first disk and the second disk make an XOR operation to get a check bit, for example, every two disks do an XOR operation, so that when a piece of disk is damaged, according to the remaining two pieces of disk can calculate the damaged part, thus guaranteeing the integrity of the data. The disk usage is (n-1)/n, and the most used in the work is the RAID 5 mode.



Create soft RAID command: Mdadm

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8A/EE/wKiom1g_i8SDLDvNAAInsD6YPD8119.png "title=" Qq20161201103239.png "alt=" Wkiom1g_i8sdldvnaainsd6ypd8119.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/EF/wKiom1g_ji3CwQegAAEdtbeFJhg194.png "title=" Qq20161201104235.png "alt=" Wkiom1g_ji3cwqegaaedtbefjhg194.png "/>


Here we begin to use examples to explain knowledge:

Start by creating a RAID 0:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8A/EB/wKioL1g_jqbjO29bAACdzZZp_IY997.png "title=" Qq20161201104431.png "alt=" Wkiol1g_jqbjo29baacdzzzp_iy997.png "/>


Environment: Two hard drives,/DEV/SDB/DEV/SDC, then separate a 1G partition on each hard drive. In order to facilitate the experiment, we use two partitions on a hard disk to operate, the principle is the same.

The steps are as follows:

① Partition:

The partitioning process is no longer mentioned here, if not please check out my other blog posts.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8A/EB/wKioL1g_j_yDGfwFAABO4eqydNE556.png "title=" Qq20161201105015.png "alt=" Wkiol1g_j_ydgfwfaabo4eqydne556.png "/>


② creating a RAID 0 disk array

Mdadm-c-v/dev/md0-l 0-n 2/DEV/SDB1/DEV/SDB2

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8A/EB/wKioL1g_kwuAx92jAAAmrR9lyxA470.png "title=" Qq20161201110353.png "alt=" Wkiol1g_kwuax92jaaamrr9lyxa470.png "/> Next we can scan the array information with the MDADM-DS command, noting that-D and-s are generally used together.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/8A/EF/wKiom1g_k_PDwUDUAAAb33-hcOI793.png "title=" Qq20161201110745.png "alt=" Wkiom1g_k_pdwuduaaab33-hcoi793.png "/>

③ to use RAID 0 also to give the MD0 partition

The partitioning method of md0 is the same as the normal partitioning method.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/8A/EB/wKioL1g_laqgWOWGAABgI2Roox8839.png "title=" Qq20161201111446.png "alt=" Wkiol1g_laqgwowgaabgi2roox8839.png "/>


Take a look:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8A/EB/wKioL1g_lkzwGbC9AAAlUZsUp4c533.png "title=" Qq20161201111744.png "alt=" Wkiol1g_lkzwgbc9aaaluzsup4c533.png "/>


④ formatting

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8A/EB/wKioL1g_lt3gpnCiAACEsCDvEd0000.png "title=" Qq20161201112007.png "alt=" Wkiol1g_lt3gpnciaacescdved0000.png "/>


⑤ Mount use

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8A/EB/wKioL1g_l2GwUjHZAABCazh1WVE873.png "title=" Qq20161201112221.png "alt=" Wkiol1g_l2gwujhzaabcazh1wve873.png "/>

In this, you can use it normally.


If you want to set up automatic mount, you need to modify the configuration file/etc/fstab

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8A/EC/wKioL1g_mL3ALHc2AACJFL-KSAk221.png "title=" Qq20161201112809.png "alt=" Wkiol1g_ml3alhc2aacjfl-ksak221.png "/>

We can use the df-h command to see the available space for md0:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/EC/wKioL1g_mTGTk7UVAAA8TXtp9ow929.png "title=" Qq20161201113003.png "alt=" Wkiol1g_mtgtk7uvaaa8txtp9ow929.png "/>


This article is from the "Brother Hong Linux World" blog, so be sure to keep this source http://zhengkangkang.blog.51cto.com/12015643/1878404

Linux disk array technology (i)--RAID0 creation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.