Home >System Tutorial >LINUX >Building RAID5 under Linux
1. Creating RAID5 requires at least 3 hard drives of the same capacity
2. The mdadm software package needs to be installed under Linux
can use
rpm -qa | grep mdadm
Command to confirm whether mdadm software is installed
1. Use the fdisk -l command to check the partition status;
fdisk -l
2. Use fdisk to partition the disk. Each partition in the RAID group needs to be the same size. The default ID of the partition is 83. Use the fd command to modify it.
fdisk
1>Creating RAID5 requires at least 3 less hard drives of the same capacity. It is recommended to use 4 hard drives of the same size, of which 3 hard drives are used as RAID5 and one hard drive is free as a hot spare.
mdadm -C /dev/md0 -l 5 -n 3 -x 1 /dev/sdb[1-4]
Note: -l RAID level, here is 5, which is RAID5 -n The number of hard disks in the RAID group, there are 3 here -x The number of hot spare disks, this amount is set to 1 /dev/sdb[1-4] Which hard disks are used? Here we use /dev/sdb1~/dev/sdb4, a total of four hard disks (3 for RAID5 and 1 for hot backup).
2>Write RAID configuration information to the configuration file
Mdadm --detail --scan --verbose /dev/md0 > /etc/mdadm.conf
Note: When Linux starts, it will automatically read /etc/mdadm.conf and configure the raid group.
3>View RAID information
a. View the detailed information of the RAID group
mdadm --detail /dev/md0
b. Check the status information of the RAID group
cat /proc/mdstat
mkfs.ext4 /dev/md0
There are two ways to mount:
vi /etc/fstab
Add a line at the end, the format is the same as above, such as: /dev/md0 /mnt_array ext4 defaults 0 0 RAID disk mapping disk format default configuration means that even if the mount fails, it will not affect the system startup
2> Mount directly (mounting is only valid for the current running time and will disappear after the system is restarted. If you need it to be valid all the time, use the above method)
mount /dev/md0 /mnt_array
The above is the detailed content of Building RAID5 under Linux. For more information, please follow other related articles on the PHP Chinese website!