1. The syntax of
mdadm mdadm --detail /dev/md0 View the raid details of /dev/md0
mdadm --create --auto=yes /dev/md[0-9] --level=[015] --raid- devices=N --spare-devices=N /dev/sdx
--create: parameters for the new raid
--auto=yes: determine the new software disk array devices that follow, namely /dev/md0, /dev/md1, etc.
--level=[015]: Set the level of the disk array
--detail: List the detailed information of the disk array device connected later
--raid-devices=N: Use several disks as the device of the disk array
--spare- devices=N: use several disks as alternate devices
mdadm --manage /dev/md[0-9] [--add /dev/sdxN] [--remove /dev/sdxN] [--fail /dev/sdxN ]
--add: The following device will be added to this md
--remove: The following device will be removed from this md
--fail: The latter device will be set to an error state
2. A raid5 instance
fdisk /dev/ sda
uses the n parameter to create 6 partitions with a size of 300M, dev/sda5-10
w, and use partprobe to refresh the partition table after saving.
Then use sda5-9 to form a raid5 array
mdadm --create --auto=yes /dev/md0 --level=5 --raid-devices=4 --spare-devices=1 /dev/sda{5,6,7 ,8,9}
View the status of the system software disk array
cat /proc/mdstat
format and mount with raid
mkfs -t ext3 /dev/md0
mkdir /mnt/raid
mount /dev/md0 /mnt/raid
View md0 software disk Array details
mdadm --detail /dev/md0
emulate rescue raid5
set /dev/sda6 to fail state (alternate /dev/sda9 will automatically make up)
mdadm --manage /dev/md0 --fail /dev/ sda6
At this time, quickly enter the following command to view the process of disk replenishment (the speed should be faster, or you will see the result of the replenishment)
mdadm --detail /dev/md0
cat /proc/mdstat
After waiting for a while, repeat the above input You can see the result after adding two commands
mdadm --detail /dev/md0
cat /proc/mdstat
Delete the wrong /dev/sda6 and add /dev/sda10 as a raid5 spare disk mdadm --manage /dev/md0 --add /dev/ sda10
--remove /dev/sda6 View the uuid
of
/dev/md
mdadm --detail /dev/md0 | grep -i uuid
You can see the following line of
UUID: 048383b6:c69991e2:f9c2bef7:39d45ef1
Next, set mdadm.conf
vi /etc/mdadm.conf
to it Add a line of
ARRAY /dev/md0 048383b6:c69991e2:f9c2bef7:39d45ef1
to set the boot to automatically mount
vi /etc/fstab
Add a line to the end
/dev/md0 /mnt/raid ext3 defaults 1 2
Test the mount set in /etc/fstab Device
umount /dev/md0
mount -a
df /mnt/md0
4. Close the software raid
first unmount /dev/md0
umount /dev/md0
and then delete the statement previously added in /etc/fstab to
directly close /dev/md0
mdadm --stop /dev/md0
to see if the raid still exists
cat /proc/mdstat
delete /etc/mdadm.conf The statement written before in
vi /etc/mdadm.conf
centos7 uses mdadm soft raid
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326655915&siteId=291194637
Recommended
Ranking