我正在运行一个非托管的 Ubuntu 服务器,由于最近的性能问题,我向提供商发送了一个请求,但只收到以下响应:
“亲爱的客户,
根据要求,我们已检查您的驱动器。两个驱动器均通过测试,没有任何错误,并且此处未显示任何关键值。我们注意到 RAID 处于降级状态,因此您需要在此处将驱动器重新添加到阵列:
-----------------%<-----------------
Personalities : [raid1]
md3 : active raid1 sda4[0]
1839089920 blocks super 1.2 [2/1] [U_]
md2 : active raid1 sda3[0]
1073610560 blocks super 1.2 [2/1] [U_]
md1 : active raid1 sda2[0]
523968 blocks super 1.2 [2/1] [U_]
md0 : active raid1 sda1[0]
16768896 blocks super 1.2 [2/1] [U_]
unused devices: <none>
-----------------%<-----------------"
Google 表示 U_ 表示驱动器故障,这似乎与支持人员的说法相矛盾。我该如何继续?
就像是
mdadm /dev/mdX -r /dev/sdaY
mdadm /dev/mdX -a /dev/sdaY
如果是,那么对于我的情况,X 和 Y 是什么?如果需要有关我的配置的更多信息,请告诉我。
编辑,更多信息如下:
root@Ubuntu-1204-precise-64-minimal /home # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 1008G 26G 931G 3% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 16G 4.0K 16G 1% /dev
tmpfs 3.2G 504K 3.2G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 16G 0 16G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/md1 488M 66M 397M 15% /boot
/dev/md3 1.7T 31G 1.6T 2% /home
root@Ubuntu-1204-precise-64-minimal /home # mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Nov 6 08:02:41 2013
Raid Level : raid1
Array Size : 16768896 (15.99 GiB 17.17 GB)
Used Dev Size : 16768896 (15.99 GiB 17.17 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Wed Dec 21 03:50:13 2016
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : rescue:0
UUID : 872ad258:c42ccb36:e9e19c96:98b55ee9
Events : 816844
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed
root@Ubuntu-1204-precise-64-minimal /home # mdadm -D /dev/md1
/dev/md1:
Version : 1.2
Creation Time : Wed Nov 6 08:02:41 2013
Raid Level : raid1
Array Size : 523968 (511.77 MiB 536.54 MB)
Used Dev Size : 523968 (511.77 MiB 536.54 MB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Wed Dec 21 07:30:55 2016
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : rescue:1
UUID : 18cb39fc:9eaea61c:0074a6c2:661b5862
Events : 387
Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
1 0 0 1 removed
root@Ubuntu-1204-precise-64-minimal /home # mdadm -D /dev/md2
/dev/md2:
Version : 1.2
Creation Time : Wed Nov 6 08:02:42 2013
Raid Level : raid1
Array Size : 1073610560 (1023.87 GiB 1099.38 GB)
Used Dev Size : 1073610560 (1023.87 GiB 1099.38 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Wed Dec 21 07:58:52 2016
State : active, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : rescue:2
UUID : eb9be750:7ff778b4:31fd7ce9:9d86d191
Events : 38799724
Number Major Minor RaidDevice State
0 8 3 0 active sync /dev/sda3
1 0 0 1 removed
root@Ubuntu-1204-precise-64-minimal /home # mdadm -D /dev/md3
/dev/md3:
Version : 1.2
Creation Time : Wed Nov 6 08:02:42 2013
Raid Level : raid1
Array Size : 1839089920 (1753.89 GiB 1883.23 GB)
Used Dev Size : 1839089920 (1753.89 GiB 1883.23 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Wed Dec 21 07:57:41 2016
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : rescue:3
UUID : c9b748ef:332d3bf9:5fa8fef1:5b433b0a
Events : 7429895
Number Major Minor RaidDevice State
0 8 4 0 active sync /dev/sda4
1 0 0 1 removed
答案1
重新添加 RAID 1 成员
要将 RAID 成员添加回阵列,请使用:
mdadm <RAID Device> -a <Device to add into the array>
例如:
$ mdadm /dev/md0 -a /dev/sdc1
mdadm: re-added /dev/sdc1
如果您使用 mdadm --detail 再次检查,您会看到 /dev/sdc1 显示为“正在重建”:
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
2 8 33 1 spare rebuilding /dev/sdc1
这意味着新添加的成员正在与其他成员上的数据同步;如果您现在检查 proc/mdstat,您可以看到同步进度 - 以百分比和条形图的形式:
$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdc1[2] sdb1[0]
976759936 blocks [2/1] [U_]
[>....................] recovery = 1.2% (12409024/976759936) finish=195.2min speed=82312K/sec
unused devices: <none>
验证在添加新的 RAID 成员后您是否仍然可以在 RAID 驱动器上看到文件:
$ ls /mnt/raid1
Music lost+found Images Films Misc
答案2
我自己解决了这个问题。我不明白 mdX 是分区,而 sda 和 sdb 是实际的物理磁盘。所以 sdb 丢失了,所以我需要把它加回来。我执行了以下命令:
sgdisk -R /dev/sdb /dev/sda
sgdisk -G /dev/sdb
mdadm /dev/md0 -a /dev/sdb1
mdadm /dev/md1 -a /dev/sdb2
mdadm /dev/md2 -a /dev/sdb3
mdadm /dev/md3 -a /dev/sdb4
重新同步一天后(可以观察)
cat /proc/mdstat
今天我看到的情况又变得好了:
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md3 : active raid1 sdb4[2] sda4[0]
1839089920 blocks super 1.2 [2/2] [UU]
md1 : active raid1 sdb2[2] sda2[0]
523968 blocks super 1.2 [2/2] [UU]
md2 : active raid1 sdb3[2] sda3[0]
1073610560 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[2] sda1[0]
16768896 blocks super 1.2 [2/2] [UU]
答案3
在按照@Tolsadus 的建议添加驱动器之前,最好先使用以下方法检查驱动器的运行状况智能工具通过执行短期和长期测试:
首先你要确保硬盘支持SMART并且已启用:
smartctl -i /dev/sdb
简短测试:
smartctl -t short /dev/sdb
长期测试:
smartctl -l selftest /dev/sdb