1.添加4块20G的硬盘,分区,类型ID为fd。
[root@localhost ~]# fdisk -l | grep raid /dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect /dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect /dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect /dev/sde1 2048 41943039 20970496 fd Linux raid autodetect2.创建两个RAID1,不添加热备份盘。
[root@localhost ~]# mdadm -C -v /dev/md101 -l1 -n2 /dev/sd{b,c}1 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=0.90 mdadm: size set to 20953088K Continue creating array? y mdadm: Fail create md101 when using /sys/module/md_mod/parameters/new_array mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md101 started. [root@localhost ~]# mdadm -C -v /dev/md102 -l1 -n2 /dev/sd{d,e}1 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=0.90 mdadm: size set to 20953088K Continue creating array? y mdadm: Fail create md102 when using /sys/module/md_mod/parameters/new_array mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md102 started.3.查看raidstat状态。
[root@localhost ~]# cat /proc/mdstat Personalities : [raid1] md102 : active raid1 sde1[1] sdd1[0] 20953088 blocks super 1.2 [2/2] [UU] [=========>...........] resync = 48.4% (10148224/20953088) finish=0.8min speed=200056K/sec md101 : active raid1 sdc1[1] sdb1[0] 20953088 blocks super 1.2 [2/2] [UU] [=============>.......] resync = 69.6% (14604672/20953088) finish=0.5min speed=200052K/sec unused devices: <none> [root@localhost ~]# cat /proc/mdstat Personalities : [raid1] md102 : active raid1 sde1[1] sdd1[0] 20953088 blocks super 1.2 [2/2] [UU] md101 : active raid1 sdc1[1] sdb1[0] 20953088 blocks super 1.2 [2/2] [UU] unused devices: <none>4.查看两个RAID1的详细信息。
[root@localhost ~]# mdadm -D /dev/md101 /dev/md101: Version : 1.2 Creation Time : Sun Aug 25 16:53:00 2019 Raid Level : raid1 Array Size : 20953088 (19.98 GiB 21.46 GB) Used Dev Size : 20953088 (19.98 GiB 21.46 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Sun Aug 25 16:53:58 2019 State : clean, resyncing Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : resync Resync Status : 62% complete Name : localhost:101 (local to host localhost) UUID : 80bb4fc5:1a628936:275ba828:17f23330 Events : 9 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 [root@localhost ~]# mdadm -D /dev/md102 /dev/md102: Version : 1.2 Creation Time : Sun Aug 25 16:53:23 2019 Raid Level : raid1 Array Size : 20953088 (19.98 GiB 21.46 GB) Used Dev Size : 20953088 (19.98 GiB 21.46 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Sun Aug 25 16:54:02 2019 State : clean, resyncing Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : resync Resync Status : 42% complete Name : localhost:102 (local to host localhost) UUID : 38abac72:74fa8a53:3a21b5e4:01ae64cd Events : 6 Number Major Minor RaidDevice State 0 8 49 0 active sync /dev/sdd1 1 8 65 1 active sync /dev/sde15.创建RAID10。
[root@localhost ~]# mdadm -C -v /dev/md10 -l0 -n2 /dev/md10{1,2} mdadm: chunk size defaults to 512K mdadm: Fail create md10 when using /sys/module/md_mod/parameters/new_array mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md10 started.6.查看raidstat状态。
[root@localhost ~]# cat /proc/mdstat Personalities : [raid1] [raid0] md10 : active raid0 md102[1] md101[0] 41871360 blocks super 1.2 512k chunks md102 : active raid1 sde1[1] sdd1[0] 20953088 blocks super 1.2 [2/2] [UU] md101 : active raid1 sdc1[1] sdb1[0] 20953088 blocks super 1.2 [2/2] [UU] unused devices: <none>7.查看RAID10的详细信息。
[root@localhost ~]# mdadm -D /dev/md10 /dev/md10: Version : 1.2 Creation Time : Sun Aug 25 16:56:08 2019 Raid Level : raid0 Array Size : 41871360 (39.93 GiB 42.88 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Sun Aug 25 16:56:08 2019 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Chunk Size : 512K Consistency Policy : none Name : localhost:10 (local to host localhost) UUID : 23c6abac:b131a049:db25cac8:686fb045 Events : 0 Number Major Minor RaidDevice State 0 9 101 0 active sync /dev/md101 1 9 102 1 active sync /dev/md102