case: Building a soft RAID disk array
Requirements Description
add to Linux server 5 Block SCSI hard disk
Use the Mdadm software package to build RAID5 + Hot Spares array for improved performance and reliability of disk storage
⑴ installation Mdadm
[Email protected] ~]# Rpm-qa |grep mdadm
⑵ preparing partitions for a RAID array
① add 5 SCSI hard disks to the Linux server and use the Fdisk tool to carve out a 2GB partition:/DEV/SDB1,/DEV/SDC1,/dev/sdd1,/dev/sde1,/DEV/SDF1
② change its type ID to "FD", which corresponds to "Linux raid AutoDetect", which indicates support for RAID disk array
[[email protected] ~]# fdisk/dev/sdb# partition the second hard drive
[Email protected] ~]# FDISK/DEV/SDC #对第三块硬盘进行分区
[Email protected] ~]# FDISK/DEV/SDD #对第四块硬盘进行分区
[Email protected] ~]# FDISK/DEV/SDE #对第五块硬盘进行分区
[Email protected] ~]# FDISK/DEV/SDF #对第六块硬盘进行分区 #依次都是按照这种形式去分
⑶ Creating a RAID device
[Email protected] ~]# Mdadm-cv/dev/md0-l5-n3/dev/sd[bcd]1-x1/dev/sde1
C:Create creates
V: Show details during creation
/dev/md0:name of RAID, starting with MD
-A Yes: automatically create device files, activate device files
-n4: create raid with a few hard drives
-L5:RAID level
- x: Specify the number of free disks (hot spare disk), the free disk (hot spare disk) can be automatically replaced after the work disk damage;-x1/dev/sde1 specifies which partition to use as the hot standby
sd[bcd]1 : What disk partitions are used to create
[Email protected] ~]# Cat/proc/mdstat #查看磁盘阵列的状态
⑷ Formatting RAID devices
[Email protected] ~]# mkfs.ext4/dev/md0
⑸ Mount
[Email protected] ~]# mkdir/mnt/md0
[Email protected] ~]# Vim/etc/fstab
[Email protected] ~]# mount-a
[Email protected] ~]# df-h
⑹ Analog Array Device failure
[Email protected] ~]# mdadm/dev/md0-f/DEV/SDB1
[Email protected] ~]# Cat/proc/mdstat #查看阵列状态
[Email protected] ~]# mdadm/dev/md0-r/dev/sdb1 #移除损坏硬盘
⑺ add another hard drive as a hot standby machine
[Email protected] ~]# mdadm/dev/md0--ADD/DEV/SDF1
[Email protected] ~]# mdadm-dvs/dev/md0 #查看阵列详细信息
Linux configuration RAID5 hot standby