Solution to common problems of Soft RAID in Linux (1)

Source: Internet
Author: User

In the article "use of software RAID in Linux", we talked about the basic concepts of software RAID in Linux and how to use mdadm program to manage software RAID devices, this section describes how to create, delete, stop, and expand a software RAID device, and how to manage its metadata and bitmap data. In this article, we will discuss common problems and solutions for using soft RAID devices.

1. The RAID sub-devices must be physically independent and unrelated.

RAID on multiple disk partitions on a disk is of no value, because not only does it violate the principle of device independence in the RAID array, but it cannot increase the reliability of the array, when this disk fails, it will inevitably lead to data loss and significantly lower the performance of the array, when data is read/written, the head jitters back and forth on multiple partitions of the disk, resulting in a long search time.

2. RAID 0 has no data redundancy Function

RAID 0 can only use the data block-based (stripping) function to improve performance. If a disk fails, data on the MD device is lost and an error occurs when reading and writing the MD device.

3. Quick test command

When creating a disk, if the data on the device is already synchronized (sync), or only used to test the array, you can use the -- assume-clean parameter to notify the MD driver that the array does not need to be initialized.

Mdadm-C/dev/md0-l5-n6/dev/sd [B-g]-x1/dev/sdh -- assume-clean

If you want to avoid the previous metadata prompts on the device during each command creation by mdadm, and avoid manual input, you can use -- run (or its abbreviation is-R) to notify the array to run the command directly.

Mdadm -- create -- run/dev/md0-l5-n6/dev/sd [B-g]-x1/dev/sdh -- assume-clean

4. RAID composed of heterogeneous Disks

RAID0 supports the construction of RAID in multiple zones on disks of different sizes. Each region has a different number of disks. Use the fdisk command to query whether/dev/sdi1 is 2 GB,/dev/sdj1 is 4 GB, And/dev/sdk1 is 1 GB. Therefore, the RAID 0 device is 7 GB.

Mdadm-C/dev/md0-l5-n6/dev/sd [B-g]-x1/dev/sdh -- assume-clean

For disks of different sizes such as RAID1, RAID456, and RAID10, only the minimum disk capacity can be used as the public size, and the excess size is wasted. The RAID 5 device made of/dev/sdi1,/dev/sdj1,/dev/sdk1 is 2 GB, which is twice that of the smallest device/dev/sdk1, the device/dev/sdi1 and sdj1 waste 1 GB and 3 GB respectively.

[Root @ fc5 mdadm-2.6.3] #./mdadm-CR/dev/md1-l0-n3/dev/sd [I-k] 1

[Root @ fc5 mdadm-2.6.3] #./mdadm-D/dev/md1 | grep "Array Size"

Array Size: 7337664 (7.00 GiB 7.51 GB)

The size (ArraySize) in the array status information query is KB, indicating the actual size of the MD block device. The following two values are only used to display the processed results.

[Root @ fc5 mdadm-2.6.3] #./mdadm-CR/dev/md1-l0-n3/dev/sd [I-k] 1

[Root @ fc5 mdadm-2.6.3] #./mdadm-D/dev/md1 | grep "Array Size"

Array Size: 7337664 (7.00 GiB 7.51 GB)

[Root @ fc5 mdadm-2.6.3] #./mdadm-CR/dev/md1-l5-n3/dev/sd [I-k] 1

[Root @ fc5 mdadm-2.6.3] #./mdadm-D/dev/md1 | grep "Array Size"

Array Size: 2096896 (2048.09 MiB 2147.22 MB)

5. Configure the shared hot spare Disk

The mdadm program allows multiple RAID groups to share redundant disks. For example, there are two Arrays:/dev/md0 and/dev/md1. At the time of creation,/dev/md0 contains a hot backup disk, while/dev/md1 does not have a hot backup disk. We only need to configure two arrays in/etc/mdadm. conf to use the same spare-group.

[Root @ fc5 mdadm-2.6.3] # cat/etc/mdadm. conf

DEVICE/dev/sdb/dev/sdc/dev/sdd/dev/sde/dev/sdf/dev/sdg/dev/sdh

/Dev/sdi1/dev/sdj1/dev/sdk1

ARRAY/dev/md1 level = raid0 num-devices = 3 spare-group = sparedisks

UUID = dcff6ec9: 53c4c668: 58b81af9: ef71989d

ARRAY/dev/md0 level = raid10 num-devices = 6 spare-group = sparedisks

UUID = 0cabc5e5: 842d4baa: e3f6261b: a17a477a

And run the mdadm monitoring mode command. When a disk/dev/sdi1 in the/dev/md1 array fails, mdadm automatically removes the spare disk from the/dev/md0 group and adds it to/dev/md1.

[Root @ fc5 mdadm-2.6.3] #./mdadm -- monitor -- mail = root @ localhost -- syslog -- program =/root/md. sh

-- Delay= 300/dev/md * -- daemonise


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.