Linux's advanced RAID disk array, the system starts and dd command

It does not require CPU RAID disk array processing hardware called

 

touch create an empty file

c character device file: read sequentially equipment needs

b block device file: the device can randomly read

 

/ dev / null black hole file

/ dev / zero white hole outwardly steady stream file output file

 

Disk Array

First, the concept

1 , What is RAID

RAID stands for Redundant the Array of Inexpensive Disks , Redundant disk arrays, by a pattern composed of multiple disks to increase throughput and reliability. Disk array is much less expensive disk, hardware ( the RAID card) or software ( mdadm composition) to form a huge capacity of the disk group, together with a plurality of disks, the entire disk to enhance system performance.

RAID can integrate into a large hard disk, may be further partitioned on a large disk, playback data; there is a big feature, a plurality of redundant disks may be put together (backup).

RAID is created in two ways: software RAID (implemented by the operating system software) and hardware RAID (using hardware array card)

RAID basic idea: the hard disk through a certain combination of several pieces it manner combined into a new set of disk array, so that it can meet the requirements of high-performance hard.

2 , the disk array function

  • The integration of idle disk space
  • Improve the efficiency of disk read
  • Provide fault tolerance

3 , RAID level

  • 0-the RAID : require the same disk capacity, the total capacity of all the disks and
  • . 1-the RAID : same disk capacity required, the total capacity of a hard disk capacity
  • + 0. 1-the RAID : Refer to RAID-0/1
  • . 5-the RAID : the same as the capacity requirements, the total disk capacity minus one
  • Spare disk: idle useless for bad disk replacement

RAID type

Minimum number of disks

Space utilization

Their advantages and disadvantages

level

Explanation

RAID0

Striped Volume

2+

100%

Read and write speed, fault tolerance is not

RAID1

Mirrored volume

2

50%

General read and write speed, fault-tolerant

RAID5

Strip coil parity

3+

n-1/n

Read and write speed, fault-tolerant, allowing a bad disk

RAID10

RAID1 Security + RAID0 speed

4

50%

Read and write speed, fault-tolerant

4 , RAID three key technologies

Mirroring: Providing security data;

Stripe (block size may also be said strip band size), its presence is to provide a data concurrency

Check data: provides data security

5 , RAID level Comments

( 1 ) RAID-0 works

Strip ( strping ), but also our earliest RAID mode, the number of disks needed 2 or more blocks ( size preferably the same ) , is to set up the disk array simplest form, only need 2 more blocks hard drive.

Features: low cost, can improve the performance of the entire disk. RAID 0 does not provide redundancy or error repair capacity, fast speed.

Any damage to a disk will be damaged all transactions; disk utilization of 100% .

( 2 ) RAID-1 works

The mirroring. 1 the RAID (mirrored), at least two hard drives.

Principle: is the mirror image of a data disk to another disk, that data is simultaneously written to a disk image file is generated on another piece of idle disks ( synchronous )

Disk utilization is 50% , i.e. 2 block 100G disk configuration RAID1 only provide 100G available space.

Disadvantages: waste of resources, high costs

( 3 ) RAID-5 works

Require three or more hard disk may be provided to achieve hot spare fault recovery; only one is damaged, there is no problem. But if also damaged two disks, the data will be corrupted. Space utilization: (. 1-n-) / n-

Features: read and write performance in general, read a little better, write well

Parity: RAID5 data recovery principle is calculated using the formula

Leftmost raw data, the right are three disks, assuming a second hard drive failure, by the first hard disk 1 on the third disk and an XOR 2 , it is possible to restore the two . Similarly for rendering 3 and 8 . As for the 5 XOR 6 is more simple, direct use of 5 and 6 operation can out.

RAID hard drive failure treatment: Hot Plug and Hot Standby

A , Hot Standby: HotSpare

Definitions: When redundant RAID when a disk fails in the group, without disturbing the current RAID under normal use of the system, with a RAID failure of a hard disk system further automatically replace normal spare drive, to ensure timely RAID redundant system sex

Global formula: spare drive to all redundant system RAID group shared

Dedicated formula: spare drive system is a group of redundant RAID group-specific

b , hot-swappable: HotSwap

Definitions: In the case of the system without affecting the normal operation, with normal physical hard disk replacement RAID failure of the hard disk system.

( . 4 ) RAID-10 Mirror + strips (nested RAID level)

RAID 10 is a mirrored and the bands were combined two RAID levels, first level is RAID1 mirror image, the second stage is RAID 0 . For example, we have 8 Kuai plate, which is corresponding pairs of mirrored, formed a new 4 Kuai disk, and then these 4 disks serve as RAID0 ; when RAID10 have a damaged hard disk will continue to work hard the rest, this time the affected hard only 2 blocks.

6 , all three RAID sort

Redundancy from good to bad: RAID1 RAID5 RAID10 RAID0

Performance from good to bad: RAID0 RAID1 RAID5 RAID10

Cost from low to high: RAID0 RAID1 RAID5 RAID10

Second, the introduction of hardware disk arrays

It does not require CPU RAID disk array processing hardware called

Interview questions: we do hardware RAID , before or after loading system? 

A: do first array system was installed , when the server starts in general, you have to enter the display configuration Riad tips.

Hard RAID : required RAID card, our disks are connected to the RAID card by its unified management and control. Data to be allocated and maintained by it; it has its own CPU , processing speed

Soft RAID : through the operating system implementation

Third, the software disk array

 

 

 

 

 

 

 

 

 

 

 

 

Four, centos7 system startup and configuration files

 

 

 

5, how to add a new partition without swap ( dd )

In the previous tutorial we mentioned how to add a swap partition, and how to give your swap for expansion. In the tutorial we use the new partition way, that is, add a new hard disk or create a new basis of the original hard disk space on a partition and format it as a swap partition, and finally to mount.

Many of my friends are now using cloud hosting, cloud hosting is generally not set up swap after (such as in a cloud) are generally used to purchase gift of disk space, and because of the small amount of data because the data does not buy the disc, resulting in there are no available partition to swap , there is no way you can not add or partition expansion swap it? Today to teach you a method!

First use dd file command to generate a fixed size, the size of the file is added or expansion swap size:

  1. dd if=/dev/zero of=/opt/swap bs=1M count=2048

Then use mkswap command to format:

  1. mkswap /opt/swap

Use swapon command to mount it:

  1. swapon /opt/swap

Look at the swap partition is not bigger?

Principle: Linux in all the file, swap for linux system is also a file, / opt / swap for linux system is also a file, so the concept on to wait. In fact these files just like a notebook, it is an entity is a carrier, we can record content in a notebook, as you can in / opt / swap write data, you understand?

 

 

 

Guess you like

Origin www.cnblogs.com/renyz/p/11205363.html