The most common disk array in Linux-RAID 5

Source: Internet
Author: User
(1) RAID introduction: Redundant Arrays of independent disks (RAID, RedundantArrayofIndependentDisks), formerly known as Redundant Arrays of cheap disks (RAID, RedundantArrayofInexpensiveDisks), or hard disk arrays. The basic idea is to put multiple relative...
(1) RAID introduction: Redundant Array of Independent Disks (RAID, Redundant Array of Independent Disks), formerly known as Redundant Array of cheap Disks (RAID, Redundant Array of Inexpensive Disks), short for hard disk arrays. The basic idea is to combine multiple relatively inexpensive hard disks into a hard disk array group, so that the performance can reach or even exceed a hard disk with a high price and huge capacity. Depending on the selected version, RAID has the following advantages over a single hard disk: enhanced data integration, enhanced fault tolerance, and increased processing capacity or capacity. In addition, the disk array looks like a separate hard disk or logical storage unit for a computer. Divided into RAID-0, RAID-1, RAID-1E, RAID-5, RAID-6, RAID-7, RAID-10, RAID-50.
In simple terms, RAID combines multiple hard disks into one logical sector. Therefore, the operating system only treats them as one hard disk. RAID is often used on server computers, and identical hard disks are often used as a combination. As hard disk prices continue to decline and RAID functions are more effectively integrated with the motherboard, it has become a choice for players, especially those who need large storage space, such as video and audio production. The initial RAID is divided into different levels, each of which has its theoretical advantages and disadvantages. different levels strike a balance between the two targets, namely increasing data reliability and increasing storage (group) read/write performance. Over the years, applications with different RAID concepts have emerged.
Www.2cto.com (2) implement soft RAID 5 in linux: 1. prepare a hard disk (at least three hard disks are required. use five partitions of one hard disk here, however, RAID on a hard disk is meaningless in actual production.) [root @ localhost ~] # Fdisk-cul/dev/sdb # create the following partitions: Disk/dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x466fc1b6Device Boot Start End Blocks Id System/dev/sdb1 2048 10487807 5242880 83 Linux/dev/sdb2 10487808 41943039 15727616 5 Extended/dev/sdb5 10489856 16781311 3145728 83 Linux/dev/sdb6 16783360 23074815 3145728 83 Linux/dev/sdb7 23076864 29368319 3145728 83 Linux/dev/sdb8 29370368 35661823 83 Linux /dev/sdb9 35663872 41943039 3139584 83 Linux [root @ localhost ~] # Partx-a/dev/sdb # Re-read the partition table [root @ localhost ~] # Rpm-qa | grep mdadm # check whether the mdadm-3.2.3-9.el6.i6862 is installed and RAID5 is created when creating raid software: [root @ localhost ~] # Mdadm-C/dev/md0-a yes-l 5-n 4-x 1/dev/sdb {5 .. 9 }####-C: Create a/dev/md0 device.-a: whether to automatically check whether yes or-l: raid level is raid5,-n: several hard disks are RUN and-x: several hard disks are used as backup mdadm: Defaulting to version 1.2 metadatamdadm: array/dev/md0 started. [root @ localhost ~] # Mdadm -- detail/dev/md0 # View details of/dev/md0/dev/md0: Version: 1.2 Creation Time: Mon Jan 14 19:36:37 2013 Raid Level: raid5Array Size: 9414144 (8.98 GiB 9.64 GB) Used Dev Size: 3138048 (2.99 GiB 3.21 GB) Raid Devices: 4 Total Devices: 5 Persistence: Superblock is persistentUpdate Time: Mon Jan 14 19:37:27 2013 State: cleanActive Devices: 4 Working Devices: 5 Failed Devices: 0 Spare Devices: 1 Layo Ut: left-outer ricchunk Size: 512 KName: localhost. localdomain: 0 (local to host localhost. localdomain) UUID: f16324c8: 0f2a0be2: 04347c07: 5f44f53eEvents: 18 Number Major Minor RaidDevice State0 8 21 0 active sync/dev/sdb51 8 22 1 active sync/dev/sdb62 8 23 2 active sync/dev/sdb75 8 24 3 active sync/dev /sdb84 8 25-spare/dev/sdb93, format, mount, use/dev/md0: [root @ localhost ~] # Mkfs. ext4/dev/md0 # Format/dev/md0 [root @ localhost ~] # Mkdir/raid5 # Create a Mount Directory [root @ localhost ~] # Mount/dev/md0/raid5/# mount/dev/md0 to the/raid5 Directory [root @ localhost ~] # Cd/raid5/[root @ localhost raid5] # touch raid5.file [root @ localhost raid5] # lslost + found raid5.file4, set boot to RAID5: [root @ localhost ~] # Mdadm -- detail -- scan # View raid brief information ARRAY/dev/md0 metadata = 1.2 spares = 1 name = localhost. localdomain: 0 UUID = f16324c8: 0f2a0be2: 04347c07: 5f44f53e [root @ localhost ~] # Mdadm -- detail -- scan>/etc/mdadm. conf # Create a soft raid configuration file! Note: If this file is not created,/dev/md0 will be automatically recognized as another non-/dev/md0 device after the next boot restart, it is inconvenient to mount and use the device at startup. [Root @ localhost ~] # Vim/etc/fstab # Edit the fstab file and add the following lines to/dev/md0/raid5 ext4 defaults 0 04. manage RAID5: View raid status: [root @ localhost ~] # Cat/proc/mdstat # View raid status Personalities: [raid6] [raid5] [raid4] md0: active raid5 sdb8 [5] sdb9 [4] (S) sdb7 [2] sdb6 [1] sdb5 [0] 9414144 blocks super 1.2 level 5,512 k chunk, algorithm 2 [4/4] [UUUU] unused devices: View detailed information of a specific raid device: [root @ localhost ~] # Mdadm -- detail/dev/md0 ................................................... Omit ........................................................ Number Major Minor RaidDevice State0 8 21 0 active sync/dev/sdb51 8 22 1 active sync/dev/sdb62 8 23 2 active sync/dev/sdb75 8 24 3 active sync/dev/ sdb84 8 25-spare/dev/sdb9 simulate hard disk damage: [root @ localhost ~] # Mdadm/dev/md0 -- fail/dev/sdb5 # simulate disk damage [root @ localhost ~] # Mdadm-detail # verify ................................................... Omit ........................................................ Name: localhost. localdomain: 0 (local to host localhost. localdomain) UUID: f16324c8: 0f2a0be2: 04347c07: 5f44f53eEvents: 25 Number Major Minor RaidDevice State4 8 25 0 spare rebuilding/dev/sdb91 8 22 1 active sync/dev/sdb62 8 23 2 active sync/dev/sdb75 8 24 3 active sync/dev /sdb80 8 21-faulty spare/dev/sdb5 ####/dev/sdb5 status changed to faulty, /dev/sdb9 is immediately turned into active simulated hard drive unplugging: [root @ localhost ~] # Mdadm/dev/md0 -- remove/dev/sdb5 # simulate unplugging the hard disk mdadm: hot removed/dev/sdb5 from/dev/md0 [root @ localhost ~] # Mdadm-detail # verify ................................................... Omit ........................................................ Name: localhost. localdomain: 0 (local to host localhost. localdomain) UUID: f16324c8: 0f2a0be2: 04347c07: 5f44f53eEvents: 4 Number Major Minor RaidDevice State4 8 25 0 active sync/dev/sdb91 8 22 1 active sync/dev/sdb62 8 23 2 active sync/dev/sdb75 8 24 3 active sync/dev /sdb8 ####/dev/sdb5 has been removed from/dev/md0: simulate adding a hard disk to raid: [root @ localhost ~] # Mdadm -- zero-superblock -- force/dev/sdb5 # repair the hard disk [root @ localhost ~] # Mdadm/dev/md0 -- add/dev/sdb5 # simulate adding the hard disk mdadm: added/dev/sdb5 to raid [root @ localhost ~] # Mdadm -- detail/dev/md0 # verify/dev/md0: Version: 1.2 Creation Time: Mon Jan 14 19:36:37 2013 Raid Level: raid5Array Size: 9414144 (8.98 GiB 9.64 GB) used Dev Size: 3138048 (2.99 GiB 3.21 GB) Raid Devices: 4 Total Devices: 5 Persistence: Superblock is persistentUpdate Time: Mon Jan 14 20:17:02 2013 State: cleanActive Devices: 4 Working Devices: 5 Failed Devices: 0 Spare Devices: 1 Layout: left-sym MetricChunk Size: 512 KName: localhost. localdomain: 0 (local to host localhost. localdomain) UUID: f16324c8: 0f2a0be2: 04347c07: 5f44f53eEvents: 41 Number Major Minor RaidDevice State4 8 25 0 active sync/dev/sdb91 8 22 1 active sync/dev/sdb62 8 23 2 active sync/dev/sdb75 8 24 3 active sync/dev /sdb86 8 21-spare/dev/sdb5 ####/dev/sdb5 has been successfully added to/dev/md0 and is waiting for use as a backup device.

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.