我有一个驱动器不想进行自检:
# smartctl -t long /dev/ada3
smartctl 6.2 2013-07-26 r3841 [FreeBSD 9.2-RELEASE-p3 amd64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 379 minutes for test to complete.
Test will complete after Thu Apr 2 07:25:59 2015
Use smartctl -X to abort test.
#
现在我希望在状态中看到一条消息“例行程序正在进行中”。这不仅是我所期望的,而且这也是所有其他设备的工作方式!
然而,我得到的却是“主机中止”:
# smartctl -l selftest /dev/ada3
smartctl 6.2 2013-07-26 r3841 [FreeBSD 9.2-RELEASE-p3 amd64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Aborted by host 90% 1068 -
# 2 Extended offline Aborted by host 90% 761 -
另一方面,如果我重新运行,smartctl -t long
则会收到一条消息,提示一项检查已在进行中,我应该等待。我可以使用 成功取消它-X
,然后使用 重新启动它-t long
,输出中会显示另一行“Aborted by host”。
这里发生了什么?
请注意,即使测试可能实际执行(尽管“剩余 90%”始终卡住!)我需要消息输出“例程正在进行中”,因为我从脚本启动 smartctl 并且我需要等待操作完成......
答案1
如果您的脚本想要查看测试是否完成,您不应该查看日志,而是查看自检执行状态(在输出中smartctl -a
)。