Skip to main content

SMART使用指令

S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology)相關介紹

smart指令的使用

安裝

apt install smartmontools -y

檢視基本資料

smartctl -i {硬碟}

開啟SMART功能

smartctl -s on (硬碟)

簡單檢測(只回覆pass/failed)

smartctl -H (硬碟)

檢查硬碟

smartctl -t (檢查方式) (硬碟)

備註:
檢查方式:
offline              # 1. No entry is placed in the selftest log.
                       # 2. The effects of this test are visible only in that it updates the SMART offline Attribute values
short                # 立即聽到 harddisk 在做野 (check the electrical and mechanical performance)
long                 # 相當於 Offline Extended self-test
conveyance(輸送)        # intended to identify damage incurred during transporting of the device
select,M-N                 # to test a range of disk LBAs
pending,N
afterselect,on afterselect,off

加-d sat可以檢查usb硬碟

最常使用short

檢驗進度查詢

smartctl -c (硬碟)

終止測試

smartctl -X

檢查測試結果

smartctl -l error /dev/sdd

備註:
-l type          # Prints either the SMART Error Log (TYPE: error, selftest, selective, directory, ssd)
-l error    => offline test 要用此看
                    prints the Summary SMART error log
                    SMART disks maintain a log of the most recent five non-trivial errors
                    the disk  power-on lifetime at which the error occurred is recorded
-l selftest => "short", "long" test 要用此看
                    The time at which the test took place, measured in hours of disk lifetime
-l ssd       => prints the Solid State Media percentage used endurance indicator
                    (0 indicates as new condition while 100 indicates the device is at the end of its lifetime)
If any errors were detected, the Logical Block Address (LBA) of the first error is printed in decimal notation.

顯示所有硬碟資料

smartctl -A (硬碟)

 

知識補充:
哪幾個S.M.A.R.T.數據項目是最關乎HDD/SDD健康度的?

S.M.A.R.T.有好多項目,其中最能反映磁盤健康狀態的指標有下列幾個:

  • Reallocated Sector Count 重定位磁區數量 – 這是一個關鍵的指標,因為它顯示了已經被發現為有缺陷並且被重新分配的扇區數量。這個數值的高值或快速增加可能指示硬碟驅動器正在失效。
  • Current Pending Sector Count 等候重定位磁區數量 – 這個屬性指示著等待重新映射的不穩定扇區的數量。增長的掛起扇區數量可以是硬碟退化的徵兆。
  • Seek Error Rate 尋道錯誤率 – 這更適用於HDD,表示找不到正確軌道的失敗率。高數值可能表明一個機械問題。
  • Read Error Rate 讀取錯誤率 – 表示在從磁碟讀取資料時發生的硬體錯誤率。高數值可能表明磁碟有問題。
  • Uncorrectable Sector Count 無法糾正的磁區數量 – 這指的是讀取/寫入一個扇區時的不可糾正錯誤的數量。高數值是硬碟驅動器可能故障的嚴重警告。
  • Spin Retry Count: 磁頭旋轉重試計數(特定於HDD)- 指示旋轉HDD的失敗嘗試次數。增加的值可能表明一個動力或機械問題。
如何解讀S.M.A.R.T.數據中的Current、Normalized, Worst 和Threshold?

S.M.A.R.T. 系統不僅用來監視硬碟的多種參數,它還提供了一套框架來解讀這些參數的值。在S.M.A.R.T. 資料中有幾個重要的欄位,包括“Current”(當前)、“Worst”(最差)、“Threshold”(閾值)、和“Normalized”(標準化)。下面我們來分別解析這些術語和它們的意義:

“Current”(當前):

  • 意義:表示該參數的即時值。
  • 如何解讀:它通常反映出硬碟目前的健康狀況,這是一個動態的數值,會隨著硬碟的使用情況而變化。

“Worst”(最差):

  • 意義:這表示硬碟在其使用歷史上該參數的最差記錄。
  • 如何解讀:它可以幫你理解硬碟在歷史時期的最差狀態。如果這個數值非常靠近閾值,你應該更加注意這個參數。

“Normalized”(標準化):

  • 意義:這是一個將“當前”值通過特定算法轉換成範圍在0-100或0-200的標準化值。
  • 如何解讀:較高的標準化值通常代表硬碟的健康狀態較好,而較低的則可能意味著存在問題。這個數值能協助你更好地理解硬碟的整體健康狀態。

“Threshold”(閾值):

  • 意義:這是由硬碟製造商設定的參數下限,如果“標準化”值低於這個閾值,硬碟會通常被標記為“失敗”。
  • 如何解讀:如果某個參數的“標準化”值低於或接近它的“閾值”,通常是一個警告信號,表示硬碟可能即將出現問題。

在解讀S.M.A.R.T. 值時,不僅要注意目前的參數值,也要考慮它們與閾值的關系以及它們隨時間的變化趨勢。如果有任何S.M.A.R.T. 值顯示潛在的問題,建議你及時備份所有重要的資料,以避免資料丟失。

參考網頁:

S.M.A.R.T. 健康度解讀:如何判斷磁盤前期損壞和不能忽視的局限性