判斷硬碟故障方式以下三種,若三項有超過兩項都發生異常,建議直接更換硬碟
1.查看硬碟是否故障 LOG 指令
2.測試壞軌指令
3.使用S.M.A.R.T.硬碟檢測
1.查看硬碟是否故障 LOG 指令
# grep "I/O error" /var/log/messages
Jun 12 15:23:30 2011 Hard Disk 2011 kernel: [ 376.184695] end_request: I/O error, dev sda, sector 793283772
Jun 12 15:23:31 2011 Hard Disk 2011 kernel: [ 394.836691] end_request: I/O error, dev sda, sector 793283772
Jun 12 15:23:31 2011 Hard Disk 2011 kernel: [ 413.212693] end_request: I/O error, dev sda, sector 793283775
Jun 12 15:23:32 2011 Hard Disk 2011 kernel: [ 431.624701] end_request: I/O error, dev sda, sector 793283783
Jun 12 15:23:33 2011 Hard Disk 2011 kernel: [ 449.808699] end_request: I/O error, dev sda, sector 793283791
Jun 12 15:23:33 2011 Hard Disk 2011 kernel: [ 468.988698] end_request: I/O error, dev sda, sector 793283929
Jun 12 15:23:33 2011 Hard Disk 2011 kernel: [ 493.208697] end_request: I/O error, dev sda, sector 793286447
Jun 12 15:23:34 2011 Hard Disk 2011 kernel: [ 511.308686] end_request: I/O error, dev sda, sector 793286447
Jun 20 08:25:08 2011 Hard Disk 2011 kernel: [ 196.904694] end_request: I/O error, dev sda, sector 793286460
Jun 20 08:26:43 2011 Hard Disk 2011 kernel: [ 131.892704] end_request: I/O error, dev sda, sector 793283799
Jun 20 08:26:43 2011 Hard Disk 2011 kernel: [ 149.992695] end_request: I/O error, dev sda, sector 793283799
Jun 20 08:26:43 2011 Hard Disk 2011 kernel: [ 168.384693] end_request: I/O error, dev sda, sector 793283808
表示這台機器的 /dev/sda 硬碟有發生壞軌的狀況
2.測試壞軌指令
# badblocks -v /dev/sda1 -o blocks.txt
Checking blocks 0 to 476461408
Checking for bad blocks (read-only test): ^C 2759968/ 476461408
# cat blocks.txt
960
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
這就是壞軌的sector。
3.使用S.M.A.R.T.硬碟檢測
看Hard Disk是否支援S.M.A.R.T:
# smartctl -i /dev/sda
看測試結果中,健康狀況的部份:
# smartctl -H /dev/sda
看測試結果中,error log的部份:
# smartctl -l error /dev/sda
若Hard Disk有支援S.M.A.R.T,則啟動S.M.A.R.T功能:
# smartctl -s on -d ata /dev/sda
smartctl version 5.34 [i686-pc-linux-gnu] Copyright (C) 2002-5 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
看測試結果:
# smartctl -d ata -a /dev/sda
smartctl version 5.34 [i686-pc-linux-gnu] Copyright (C) 2002-5 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: Hitachi HDS721050DLE660 # 硬碟型號
Serial Number: MSK4235H2NB59C # 硬碟序號
Firmware Version: MS1OA610
User Capacity: 500,107,862,016 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: Not recognized. Minor revision code: 0x29
Local Time is: Tue Nov 11 23:39:03 2014 PST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled # 硬碟支援S.M.A.R.T並且已經開啟
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED # 硬碟檢測正常
General SMART Values:
Offline data collection status: (0x80) Offline data collection activity
was never started.
Auto Offline Data Collection: Enabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (4966) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 83) minutes.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 100 100 054 Pre-fail Offline - 0
3 Spin_Up_Time 0x0007 100 100 024 Pre-fail Always - 0
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 2
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 100 100 020 Pre-fail Offline - 0
9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 5
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 2
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 2
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 2
194 Temperature_Celsius 0x0002 181 181 000 Old_age Always - 33 (Lifetime Min/Max 25/34)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
SMART Error Log Version: 1
No Errors Logged # 如果有error log表示硬碟可能曾經發生過問題
SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
若ID# 5、7、10、11、196~200這幾個項目的RAW_VALUE不為0,且持續增加,應立即備分並更換硬碟。
Refer: http://en.wikipedia.org/wiki/S.M.A.R.T.
1 |
Raw Read Error Rate |
讀取錯誤率 (供應商提供參數,Seagate硬碟可忽略) |
3 |
Spin Up Time |
起轉時間 可能代表主軸馬達老化 |
4 |
Start/Stop Count |
啟動/停止的次數 這個值是硬碟主軸馬達啟動/關閉的次數,一般來說就是你開關電源的次數 由於硬碟馬達啟/停時磨耗最大,這是一個壽命參考值 |
5 |
Reallocated Sector Count |
重新分配磁區數量 硬碟發現有磁區讀取/寫入/驗證錯誤時,會把磁區標記起來並且把這些磁區重新分配到空的區塊。當這個值出現時可能出現瑕疵 ,此數值只大於1即可判定硬碟有問題 |
7 |
Seek Error Rate |
尋軌錯誤率 (供應商提供參數,Seagate硬碟可忽略) |
9 |
Power-On Hours Count |
總通電時間 硬碟總通電時間,這是一個壽命參考值 (超過25000小時約等於3年時間) |
10 |
Spin-up Retry Count |
嘗試起轉重試次數 這個屬性值如果一直增加表示可能主軸馬達損壞的前兆 |
12 |
Power Cycle Count |
電源循環次數 硬碟開機/關機的循環次數 |
188 |
Command Timeout |
對硬碟下指令逾時 通常這個屬性值應該為0,若大於零可能與硬碟電源或者是硬碟接線有關 |
197 |
Current Pending Sector Count |
代表無法修復的壞磁區數量,也就是壞軌 此數值只大於1即可判定硬碟有問題 |
留言列表