S.M.A.R.T. 是 Self – Monitoring, Analysis and Reporting Technology (硬碟自我監測、分析及報告技術) 的縮寫,可以在硬碟發生故障之前,先提出警訊,可以提早因應。
在 Linux 下只要安裝 smartmontools 套件即可
# rpm -qf /usr/sbin/smartctl
smartmontools-5.42-2.el5
啟動 smartd 服務
# chkconfig –level 3 smartd on
# chkconfig –list | grep smartd
smartd 0:關閉 1:關閉 2:關閉 3:開啟 4:關閉 5:關閉 6:關閉
[@more@]檢查硬碟是否有開啟 smart 功能
# smartctl -i /dev/sda
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.10
Device Model: ST3160815AS
Serial Number: 5RA19L2P
Firmware Version: 3.AAD
User Capacity: 160,040,803,840 bytes [160 GB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Tue Oct 22 16:14:33 2013 CST
SMART support is: Available – device has SMART capability.
SMART support is: Enabled
如果有沒開啟
# smartctl -s on /dev/sda
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
檢查硬碟狀況
# smartctl -H /dev/sda
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
不過這邊出現 PASSED 並不代表一定沒有問題,要進一步檢查
進行快速檢查,大概需要 1 分多鐘
# smartctl -t short /dev/sda
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: “Execute SMART Short self-test routine immediately in off-line mode”.
Drive command “Execute SMART Short self-test routine immediately in off-line mode” successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Tue Oct 22 16:19:21 2013
Use smartctl -X to abort test.
# smartctl -l selftest /dev/sda
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== 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: read failure 90% 46396 3103025
# 2 Short offline Completed: read failure 90% 46387 3103025
# 3 Short offline Completed: read failure 90% 46387 3103025
# 4 Short offline Completed: read failure 90% 45099 3103019
由上面可以看出有 read faillure 的狀況,應該趕快備份資料了!
# smartctl -l selftest /dev/sdb
smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-8.1.10.el5] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== 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% 46426 –
# 2 Short offline Completed without error 00% 46418 –
上面這一台,是沒有問題的。
更詳細的使用參數
# smartctl –help