Soft RAID5 Making

Source: Internet
Author: User


Take RAID5 as an example:

1. Add 4 disks
Requirements: capacity, speed, interface of the same hard drive.

2. Create a partition and modify the ID
[Email protected] ~]# Fdisk/dev/sdb
[Email protected] ~]# FDISK/DEV/SDC
[Email protected] ~]# FDISK/DEV/SDD
[Email protected] ~]# FDISK/DEV/SDE
Note: The modification ID is FD (RAID supported)
Device Boot Start End Blocks Id System
/DEV/SDB1 1 652 5237245+ fd Linux Raid AutoDetect
/DEV/SDC1 1 652 4563889+ fd Linux Raid AutoDetect
/DEV/SDD1 1 652 1254356+ fd Linux Raid AutoDetect
/dev/sde1 1 652 7034359+ fd Linux Raid AutoDetect

3. Create Raid5
[Email protected] ~]# Mdadm--version
[Email protected] ~]# mdadm-v
[Email protected] ~]# Cat/proc/devices | grep MD
[[email protected] ~]# ls/dev/md* #查看软阵列 (software RAID) device file name
[[email protected] ~]# mdadm-c[Create]/DEV/MD0[RAID5 name]-l5[raid level]-n3[active device blocks]-x1[hot standby device blocks]/dev/sdb1/dev/sdc1/dev/sd D1/dev/sde1
[Email protected] ~]# Cat/proc/mdstat
[Email protected] ~]# Mdadm–ds
[Email protected] ~]# mkfs-t ext3/dev/md0 #格式化设备md0
[Email protected] ~]# mkdir/md0
[Email protected] ~]# mount/dev/md0/md0/#挂载使用
[[Email protected] ~] #df-ht #查看可用空间
[[Email protected] ~] #mdadm-ds >/etc/mdadm.conf #生成磁盘阵列配置文件

4. Repair RAID5 disk array
[Email protected] ~]# mdadm-ds/dev/md0 #查看指定的设备: This command allows you to view active devices and hot standby devices.


[[Email protected] ~] #mdadm-F/DEV/MD0/DEV/SDC1 #标识 SDC1 device is bad
[[Email protected] ~] #mdadm-ds/dev/md0
[[Email protected] ~] #mdadm-R/DEV/MD0/DEV/SDC1 #移除已坏设备sdc1
[[Email protected] ~] #mdadm-ds/dev/md0
[[Email protected] ~] #mdadm-a/DEV/MD0/DEV/SDC1 #sdc1设备修好以后, added to md0 as a hot standby device.

By default, only/dev/md0 this block device file is available in the system. If you need additional raid, you need to create it manually. As follows:
[[email protected] ~]# mknod/dev/md1[create MD1 block device file,] b[represents block device] 9[main device number, 9 means disk array, main device number cannot be modified. ] 1[1 is represented from the device number, which is unique from the device number within the system. ]
[Email protected] ~]# vim/etc/rc.local
Added: Mknod/dev/md1 B 9 1 # DEV/MD1 file is lost after system reboot, in order to be able to generate automatically at System boot, add mknod/dev/md1 B 9 1 command in rc.local file. ]

[Email protected] ~]# ls/dev/md*
[Email protected] ~]# MKNOD/DEV/MD1 B 9 1
[Email protected] ~]# MKNOD/DEV/MD2 B 9 2
[Email protected] ~]# MKNOD/DEV/MD3 B 9 3

[Email protected] ~]# ls/dev/md*
Other:
Mdadm Use options:
--create (or its abbreviation-c) parameter to create a new display and to write the identity information of some important arrays as metadata can be written in the specified interval of each underlying device
--level (or its abbreviation-L) indicates the raid level of the array
--chunk (or its abbreviation-c) represents the size of each stripe unit in kilobytes, which defaults to 64KB, and the size configuration of the stripe element has a significant impact on the performance of the array under different loads
--raid-devices (or its abbreviation-N) indicates the number of active devices in the array
--spare-devices (or its abbreviation-X) indicates the number of hot spares in the array, and once a disk in the array fails, the MD kernel driver automatically joins the hot spare disk to the array and then reconstructs the lost disk data onto the hot spare disk.

Create a RAID 0 device:
Mdadm--create/dev/md0--level=0--chunk=32--raid-devices=3/dev/sdb1/dev/sdc1/dev/sdd1

Create a RAID 1 device:
Mdadm--create/dev/md0--level=1--chunk=128--raid-devices=2--spare-devices=1/dev/sdb1/dev/sdc1/dev/sdd1

Create a RAID5 device:
Mdadm--create/dev/md0--level=5--raid-devices=5/dev/sd[c-g]1--spare-devices=1/dev/sdb1

Create a RAID 10 device:
Mdadm-c/dev/md0-l10-n6/dev/sd[b-g]-x1/dev/sdh

Create a raid1+0 device:
Mdadm-c/DEV/MD0-L1-N2/DEV/SDB/DEV/SDC
Mdadm-c/DEV/MD1-L1-N2/DEV/SDD/DEV/SDE
Mdadm-c/DEV/MD2-L1-N2/DEV/SDF/DEV/SDG
Mdadm-c/DEV/MD3-L0-N3/DEV/MD0/DEV/MD1/DEV/MD2

To stop an array device class as shown in array is started to first stop this device first uninstall
Umount/dev/md0 then mdadm–s/dev/md0

, clear the Super block information of the array in the member disk, this step is very important!
[Email protected] ~]# Mdadm--zero-superblock/dev/sdb[1-3,5]

, delete, or comment mount information on the/etc/fstab
[Rootlinux02 ~]# Vim/etc/fstab
#UUID =796a27da-d899-4e64-a3bd-b468fb0c4f37/mnt/raid5 ext4 Defaults 0 0

, delete, or annotate the raid information for/etc/mdadm.conf:
[Email protected] ~]# vim/etc/mdadm.conf
#ARRAY/dev/md0 metadata=1.2 Spares=1 name=kashu.localdomain:0 Uuid=3895d28e:bdcaed28:136b4cf6:d2a858f5

, if finished all the above operation, found/dev/under the md0 this device file exists, directly rm-f/dev/md0 can

Soft RAID5 Production

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.