Hard-Disk

SmartMonTools:我如何知道我的硬碟上是否執行了 smartctl 測試?

  • November 29, 2017

我正在使用SmartMonTools測試硬碟

測試前的硬碟狀態(幾天前只進行了一次簡短的測試):

$ sudo smartctl -l selftest /dev/sda
smartctl 6.2 2013-07-26 r3841 [i686-linux-3.16.0-30-generic] (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  Short offline       Completed without error       00%      5167         -

所以我開始了漫長的測試

$ sudo smartctl -t long /dev/sda
smartctl 6.2 2013-07-26 r3841 [i686-linux-3.16.0-30-generic] (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 130 minutes for test to complete.
Test will complete after Sat May  9 16:05:27 2015

Use smartctl -X to abort test.

那麼,測試應該正在執行,但是如果我嘗試查看它的進度:

$ sudo smartctl -l selftest /dev/sda
smartctl 6.2 2013-07-26 r3841 [i686-linux-3.16.0-30-generic] (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  Short offline       Completed without error       00%      5167         -

…我得到的只是相同的結果,就像現在沒有執行/執行測試一樣。

‘-H’ 參數沒有提供更多資訊:

$ sudo smartctl -H /dev/sda
smartctl 6.2 2013-07-26 r3841 [i686-linux-3.16.0-30-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

而且,只要沒有程序在執行(這個測試是由硬碟控制器單獨執行的),一些ps -e風格搜尋應該不會有幫助。

我怎麼知道現在是否有一些 SMART 自檢正在執行

smartctl -a <device>尋找Self-test execution status

沒有執行測試時的範例:

Self-test execution status:      (   0) The previous self-test routine completed
                                       without error or no self-test has ever
                                       been run.

測試執行時的範例:

Self-test execution status:      ( 249) Self-test routine in progress...
                                       90% of test remaining.

執行選擇性自檢 ( -t select) 時,這裡也會顯示一個進度:

SMART Selective self-test log data structure revision number 1
SPAN  MIN_LBA    MAX_LBA  CURRENT_TEST_STATUS
   1        0  125045423  Self_test_in_progress [90% left] (2881512-2947047)

引用自:https://unix.stackexchange.com/questions/202400