Linux Learning Note 10 (RAID Basics)

Source: Internet
Author: User

Disk Management is important for an OPS engineer. How to manage the data, you can not do without raid.

Content:

1. Common Types of RAID:

  • RAID0 (Strip)

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4C/2D/wKioL1Q3uY-j5MMgAACbfrJJtok640.jpg "title=" 1.PNG " alt= "Wkiol1q3uy-j5mmgaacbfrjjtok640.jpg"/>

  • RAID1 (Mirror)

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/2D/wKioL1Q3ufyiOkzaAACQkt6mi1k438.jpg "title=" 2.PNG " alt= "Wkiol1q3ufyiokzaaacqkt6mi1k438.jpg"/>

  • RAID5 (Parity check)

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/2D/wKioL1Q3ujXATegRAACwzkxBu1E313.jpg "title=" Capture 5. PNG "alt=" Wkiol1q3ujxategraacwzkxbu1e313.jpg "/>

  • Raid1 + Raid0 (first 1 after 0)                         &NB Sp                          ,         &NB Sp       

  • RAID0+RAID1 (first 0 after 1)

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4C/2D/wKioL1Q3us7zDgV7AADkgcpAuw0861.jpg "title=" Capture 01. PNG "alt=" Wkiol1q3us7zdgv7aadkgcpauw0861.jpg "/>

  • Raid5+raid0

  • RAID0+RAID5 Ibid.

  • Jbod is also commonly used, which can be expanded by increasing the number of hard drives.

    Summarize:

    Raid0
    Performance improvement: Read, write
    Redundancy capability: None
    Space utilization: NS
    At least 2 pieces of disk
    Raid1
    Performance gains: Read performance gains, write performance drops
    Redundancy capability: Available
    Space utilization: 1/2
    At least 2 pieces of disk
    Raid5
    Performance improvement: Read, write promotion
    Redundancy capability: Available
    Space utilization: (n-1)/n
    At least 3 plates required
    Raid1+raid0
    Performance improvement: Read, write promotion
    Redundancy capability: Available
    Space utilization: 1/2
    At least 4 plates required
    Raid0+raid1
    Performance improvement: Read, write promotion
    Redundancy capability: Available
    Space utilization: 1/2
    At least 4 plates required
    Raid5+raid0
    Performance improvement: Read, write promotion
    Redundancy capability: Available
    Space utilization: (n-2)/n
    At least 6 plates required
    Jbod Performance improvement: None
    Redundancy capability: None
    Space utilization: 100%
    Need at least 2 bucks.


2. Implement raid

RAID can be done through software simulations, where there is an environment for hardware RAID.

Logical raid:/dev/dm# #代表着编号

Some soft raid software uses:

Md:raid Module

    • Mdadm (MD Manager): RAID any block device

Modal Commands:

Create a pattern

-C

Dedicated options:

-L: Level

-N #: Number of devices

-a {Yes|no}: whether to automatically create a device file for it

-c:chunk Size (chunk size), 2^n, default is 64K

-X #: Specify the number of free disks (after a disk is broken, it can be on top)

Management Mode

--add,--remove,--fail

mdadm/dev/md#--fail/dev/sda7

Monitoring mode

-F

Growth Model

-G

Assembly Mode

-A


View details of a RAID array

Mdadm-d/dev/md#

--detail

Stop array:

mdadm-s/dev/md#

--stop

Practice:

Create a RAID5 device with a space size of 10G and a chuck size of 32k, requiring the device to automatically mount to the/backup directory when it is powered on;


Create a 2G size RAID0 can be 4 x 512MB or 2 1G

Create a 2G size RAID1 can be 2 x 2G

Create a 2G size RAID5 can be 3 x 1G



    • Watch: Executes the specified command periodically and displays the results in full-screen mode

-N #: Specifies the period length in seconds and defaults to 2

Format: Watch-n # ' COMMAND ' (double quotes also line)

Example: Watch "Cat/proc/mdstat"

    • Save the current RAID information to a configuration file for later assembly:

mdamd-d--scan >/etc/mdadm.conf

Mdamd-a/dev/md# can be assembled directly.

Attention:

    1. If a chunk is 64k a disk block is 4K (4096) then this means: a chunk is 16 disk blocks.

    2. The MKE2FS has the-e stride function to adjust the chunk by a multiple of the block size, which optimizes the soft raid

3.rm-f/dev/md# should be mdadm-s/dev/md# (stop soft raid) before.

3 Specific processes: (Take Raid0 as an example)

1. Create/dev/sda{5,6,7}, and the type is RAID type

2.PARTPORBE/DEV/SDA (update partition information)

3.cat/proc/partitions (view partition)

4.mdadm-c/dev/md0-n 2-l 0-x 1-a yes/dev/sda{5,6,7}

5.mdadm-d/dev/md0 (can see the running situation)



This article from "Technology first" blog, declined reprint!

Linux Learning Note 10 (RAID Basics)

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.