Raid configuration in linux

Source: Internet
Author: User

I recently learned how to configure raid in linux as follows:
1. Preliminary work
Change the system id of the partition to fd.
2. raid
Mdadm-C/dev/md2-l 5-n 3/dev/sdb8/dev/sdb9/dev/sdb10
-C is the name specified for creating a raid volume/dev/md2
-L the specified raid level is also a raid type.
-N: specify several devices (partition or hard disk) to create a raid volume.
3. view the raid volume status
# Cat/proc/mdstat
[Root @ client/] # cat/proc/mdstat
Personalities: [raid1] [raid6] [raid5] [raid4]
Md2: active raid5 sdb10 [2] sdb9 [1] sdb8 [0]
③ 208640 blocks level 5, 64 k chunk, algorithm 2 [3/3] [UUU]
① Md0: active raid1 sdb7 [2] (S) sdb6 [1] sdb5 [0]
② 200640 blocks [2/2] [UU]
Row ① indicates that md0 is RAID 1 and uses sdb7 sdb6 sdb5 to form four partitions. The numbers in the [] after each partition are in the RAID order. The S after sdb7 indicates that sdb7 is spare (hot spare disk)
Row ② indicates that the raid array has 208640 blocks (each block is 1 kb), so the total capacity is 200 MB. [M/n] indicates that the array requires m devices, n devices are running normally. The following [UU] indicates the startup status of all m devices, and U indicates normal. If it is "_", it indicates abnormal. ③ The raid5 array has "level 5, the 64 k chunk and algorithm 2 fields are represented as "RAID 5-level arrays, the size of the chunk written to the disk is 64 KB, and the algorithm 2 full-column algorithm is used.
 
Or run the command to view the raid status.
# Mdadm -- detail/dev/md0
4. Replace bad Disk
Shutdown -- change disk -- start -- Run Command
# Mdadm-a/dev/md0/dev/sdb // Add new hard disk sdb like md0raid volume
1. Create a New partition and run the partprobe command to make the new partition take effect immediately.
2. Remove the problematic disk and add a new hard disk partition.
# Mdadm -- mange/dev/md0-a/dev/sab7 -- remove/dev/sdb6
5. In many versions of linux, You can query the physical location of/dev/md [0-9] by yourself, and then set the required functions when starting the system.
However, it is recommended that you modify the configuration file yourself.
[Root @ client/] # mdadm -- detail/dev/md0 | grep-I uuid
UUID: f94014e0: 830c2c51: e8e063b6: 206e09a4
// UUID: the UUID that the device registers with the system.
# Vim/etc/mdadm. conf add a line here
ARRAY/dev/md0 UUID = f94014e0: 830c2c51: e8e063b6: 206e09a4
6. Delete raid
# Mdadm -- stop/dev/md0
# Cat/proc/mdstat view the raid0 status
# Vim/etcmdadm. conf: delete related information
# Vim/etc/fstab Delete related information
Author: "New network subnet"

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.