我有一台 Ubuntu 专用服务器,我从提供商那里收到一条消息,说我的一个磁盘出现错误,并且在他们更换磁盘之前我必须“检查我的 RAID 软件是否正常运行”。这是我在 shell 中输入的内容和得到的报告:
root@Ubuntu-1204-precise-64-minimal # cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md3 : active raid1 sda4[0] sdb4[1]
1839089920 blocks super 1.2 [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
523968 blocks super 1.2 [2/2] [UU]
md2 : active raid1 sda3[0] sdb3[1]
1073610560 blocks super 1.2 [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[0]
16768896 blocks super 1.2 [2/2] [UU]
unused devices: <none>
root@Ubuntu-1204-precise-64-minimal # 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 : 2
Persistence : Superblock is persistent
Update Time : Thu Sep 10 04:02:26 2015
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : rescue:0
UUID : 872ad258:c42ccb36:e9e19c96:98b55ee9
Events : 156
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
Run Code Online (Sandbox Code Playgroud)
这是否意味着 RAID 正在运行并且我的所有驱动器都已同步?如果没有,如何检查驱动器是否同步以及更换磁盘是否安全?
谢谢。
小智 6
是的。cat /proc/mdstat
和的输出mdadm -D
都表明该数组一切正常。
State: clean
和
[UU]
是重要的通知者,表明您的阵列正在按预期工作。
您可以仔细检查md上的内核文档
clean - no pending writes, but otherwise active.
When written to inactive array, starts without resync
If a write request arrives then
if metadata is known, mark 'dirty' and switch to 'active'.
if not known, block and switch to write-pending
If written to an active array that has pending writes, then fails.
Run Code Online (Sandbox Code Playgroud)
以及mdstat上的 Linux 内核 Wiki
摘自 wiki 条目的解释:
[UU] 代表每个设备的状态,U 表示启动,_ 表示关闭。
如果您想设置电子邮件来提醒您软件 raid 阵列出现问题,那么您可以使用 Ubuntu 论坛上的这篇文章:http://ubuntuforums.org/showthread.php ?t=1185134 应该会步行您通过一个过程来设置发送到远程帐户的电子邮件。
如果您想仔细检查阵列是否正常,您可以随时使用此命令:/usr/share/mdadm/checkarray -a /dev/mdX
此命令也应该/etc/cron.d/mdadm
每月运行一次。
除此之外,smartctl
如果您怀疑即将发生的硬件故障尚未触发阵列中的故障,则可能运行可能是合理的。示例可以在这里找到:使用 smartctl 进行 SMART 检查
最后,因为这一点永远不会说太多:确保您有经过良好测试的备份!=D Raid 非常好,但它不能替代备份,当您知道自己有良好的备份时,来自提供商的此类消息就不那么可怕了。=)
希望有帮助。=)