问题就出在这里。我把所有磁盘分成 4 个分区。使用所有磁盘分区 1 创建 raid1(md0)。但是,重启后一些 raid 成员丢失,raid 降级。使用 blkid 检查 UUID 并发现它丢失了。
创建命令:
mdadm -C ${RAID_CHECK} -l 1 -n ${disk_num} ${disk_str};
然后写入配置:
mdadm --detail --scan > /etc/mdadm.conf
创建后:
mdadm -D /dev/md0 显示:
[root@afa_primary ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Fri Jul 26 13:58:44 2019
Raid Level : raid1
Array Size : 1039360 (1015.00 MiB 1064.30 MB)
Used Dev Size : 1039360 (1015.00 MiB 1064.30 MB)
Raid Devices : 8
Total Devices : 8
Persistence : Superblock is persistent
Update Time : Mon Jul 29 11:10:54 2019
State : clean
Active Devices : 8
Working Devices : 8
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
Name : afa_primary:0 (local to host afa_primary)
UUID : 5645af3f:a0bc4deb:8f876e72:0520f210
Events : 149
Number Major Minor RaidDevice State
0 259 7 0 active sync /dev/nvme1n1p1
1 259 2 1 active sync /dev/nvme2n1p1
2 259 23 2 active sync /dev/nvme3n1p1
8 259 18 3 active sync /dev/nvme4n1p1
9 259 27 4 active sync /dev/nvme5n1p1
10 259 38 5 active sync /dev/nvme6n1p1
6 259 14 6 active sync /dev/nvme7n1p1
11 259 42 7 active sync /dev/nvme8n1p1
使用 blkid 检查每个成员:
[root@afa_primary ~]# blkid /dev/nvme4n1p1
/dev/nvme4n1p1: UUID="5645af3f-a0bc-4deb-8f87-6e720520f210" UUID_SUB="82e5c45d-857e-b54b-f4d8-c1f8a83e61a1" LABEL="afa_primary:0" TYPE="linux_raid_member" PARTLABEL="primary" PARTUUID="9cb306a4-527f-47ec-a134-f0272b185108"
You have new mail in /var/spool/mail/root
[root@afa_primary ~]# blkid /dev/nvme5n1p1
/dev/nvme5n1p1: UUID="5645af3f-a0bc-4deb-8f87-6e720520f210" UUID_SUB="bfe17ad0-3209-47c0-54df-853c0e59618d" LABEL="afa_primary:0" TYPE="linux_raid_member" PARTLABEL="primary" PARTUUID="79e1b000-51e3-4742-8f9c-8c0eb9ab29cc"
[root@afa_primary ~]#
我的磁盘列表是:
[root@afa_primary ~]# nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 PHHH9012029A128A INTEL SSDPEKKA128G8 1 128.04 GB / 128.04 GB 512 B + 0 B 006D
/dev/nvme1n1 FL191900274 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme2n1 FL191900379 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme3n1 FL191900343 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme4n1 FL191900355 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme5n1 FL191900222 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme6n1 FL191900349 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme7n1 FL191900372 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
/dev/nvme8n1 FL191900214 P5510DS0384T00 1 3.84 TB / 3.84 TB 512 B + 0 B 224003K0
重启后,
[root@afa_primary ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Mon Jul 29 11:54:37 2019
Raid Level : raid1
Array Size : 1039360 (1015.00 MiB 1064.30 MB)
Used Dev Size : 1039360 (1015.00 MiB 1064.30 MB)
Raid Devices : 8
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Mon Jul 29 11:54:42 2019
State : clean, degraded
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
Name : afa_primary:0 (local to host afa_primary)
UUID : a4ed7a9d:dae6864e:3d03a4ed:6c0d7145
Events : 17
Number Major Minor RaidDevice State
0 259 27 0 active sync /dev/nvme1n1p1
1 259 15 1 active sync /dev/nvme2n1p1
2 259 33 2 active sync /dev/nvme3n1p1
- 0 0 3 removed
- 0 0 4 removed
- 0 0 5 removed
6 259 10 6 active sync /dev/nvme7n1p1
- 0 0 7 removed
You have new mail in /var/spool/mail/root
[root@afa_primary ~]#
检查 blkid 并且丢失
[root@afa_primary ~]# blkid /dev/nvme4n1p1
/dev/nvme4n1p1: PTTYPE="gpt" PARTLABEL="p1" PARTUUID="2149f139-6b8c-4a85-918f-4150fbbb8931"
[root@afa_primary ~]#