背景
对软RAID(mdadm)方式进行各个场景失效测试。
一、初始信息
内核版本:
root@omv30:~# uname -a
Linux omv30 4.18.0-0.bpo.1-amd64 #1 SMP Debian 4.18.6-1~bpo9+1 (2018-09-13) x86_64 GNU/Linux
root@omv30:~# mdadm --version
mdadm - v3.4 - 28th January 2016
使用omv创建RAID1之后,查询sdb的信息,此时sdb对应的是8ac693c5的UUID,device号为1:
root@omv30:~# mdadm --query /dev/sdb
/dev/sdb: is not an md array
/dev/sdb: device 1 in 2 device undetected raid1 /dev/md0. Use mdadm --examine for more detail.
root@omv30:~# mdadm --examine /dev/sdb
/dev/sdb:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 921a8946:b273e00e:3fa4b99d:040a4437
Name : omv30:raid1 (local to host omv30)
Creation Time : Sun Sep 30 22:31:39 2018
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 2095104 (1023.00 MiB 1072.69 MB)
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Data Offset : 2048 sectors
Super Offset : 8 sectors
Unused Space : before=1960 sectors, after=0 sectors
State : clean
Device UUID : 64a58fb5:c7e76b1a:29453878:8ac693c5
Update Time : Mon Oct 1 13:20:56 2018
Bad Block Log : 512 entries available at offset 72 sectors
Checksum : 2e1fb65b - correct
Events : 21
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
root@omv30:~# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun Sep 30 22:31:39 2018
Raid Level : raid1
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Mon Oct 1 19:46:42 2018
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : omv30:raid1 (local to host omv30)
UUID : 921a8946:b273e00e:3fa4b99d:040a4437
Events : 25
Number Major Minor RaidDevice State
0 8 32 0 active sync /dev/sdc
1 8 16 1 active sync /dev/sdb
配置文件信息:
root@omv30:~# cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
# Note, if no DEVICE line is present, then "DEVICE partitions" is assumed.
# To avoid the auto-assembly of RAID devices a pattern that CAN'T match is
# used if no RAID devices are configured.
DEVICE partitions
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# definitions of existing MD arrays
ARRAY /dev/md0 metadata=1.2 name=omv30:raid1 UUID=921a8946:b273e00e:3fa4b99d:040a4437
二、盘符错乱测试
1、盘符交换测试
在VirtualBox的存储-SATA下,分别选中两块硬盘,在右边的属性将SATA端口调换位置,即可交换盘符。
root@omv30:~# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun Sep 30 22:31:39 2018
Raid Level : raid1
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Mon Oct 1 19:52:46 2018
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : omv30:raid1 (local to host omv30)
UUID : 921a8946:b273e00e:3fa4b99d:040a4437
Events : 29
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
可以看到盘符已经换了。
root@omv30:~# mdadm --examine /dev/sdb
/dev/sdb:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 921a8946:b273e00e:3fa4b99d:040a4437
Name : omv30:raid1 (local to host omv30)
Creation Time : Sun Sep 30 22:31:39 2018
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 2095104 (1023.00 MiB 1072.69 MB)
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Data Offset : 2048 sectors
Super Offset : 8 sectors
Unused Space : before=1960 sectors, after=0 sectors
State : clean
Device UUID : 6e545465:3dcf10df:1d5bb938:fe840307
Update Time : Mon Oct 1 19:52:46 2018
Bad Bloc