在windows系統下檢測磁盤是否有問題的方法有
可以安裝一些檢測的工具來測試硬碟是否是壞道
a)HD Tune 軟體可以檢測硬碟是否有壞道 使用很簡單的,網上下載下傳好之後直接安裝在系統上之後,打開安裝的軟體之後,點錯誤掃描就可以了
b)HD Sentinel 這款軟體也可以檢測的
下載下傳位址:http://www.hdsentinel.com/hard_disk_sentinel_trial.php
在系統上安裝HD Sentinel之後,打開看Performance和Health這2個的數值
2.在linux系統上檢測磁盤的方法
a)使用badblocks檢測硬碟壞塊
badblocks指令可以檢查磁盤裝置中損壞的區塊。執行該指令時須指定所要檢查的磁盤裝置,及此裝置的磁盤區塊數。
badblocks -s顯示進度 -v顯示執行詳細情況 /dev/sda1
[root@c18p35 ~]# badblocks -sv /dev/sda1(以隻讀的方法檢測)
Checking blocks 0 to 255999
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.
badblocks -s顯示進度 -w以寫去檢測 -v顯示執行詳細情況 /dev/sda2
# badblocks -w -s -v /dev/sda1
注意,不能以寫的方式檢測已經挂載的硬碟
b)使用hdparm測試
測試硬碟讀寫速度
[root@c18p35 ~]# hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 8056 MB in 2.00 seconds = 4032.49 MB/sec
Timing buffered disk reads: 182 MB in 3.03 seconds = 60.15 MB/sec
c)使用SMART檢測硬碟
1.啟動監控程序
# /etc/init.d/smartd start
2.檢查硬碟是否支援SMART,使用如下指令可以來檢視:
[root@c18p35 ~]# smartctl -i /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
START OF INFORMATION SECTION
Model Family: Western Digital Caviar SE Serial ATA family
Device Model: WDC WD2500JS-75NCB3
Serial Number: WD-WCANK7680933
Firmware Version: 10.02E04
User Capacity: 250,000,000,000 bytes
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: Sun Jul 22 11:18:44 2012 PDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
在上面的資訊可以看到,該硬碟是支援SMART技術,且目前是開啟的。如果SMART support is: Disabled表示SMART未啟用,
執行如下指令,啟動SMART:
[root@c18p35 ~]# smartctl –smart=on –offlineauto=on –saveauto=on /dev/sda
3.檢查硬碟健康狀态
[root@c18p35 ~]# smartctl -H /dev/sda
START OF READ SMART DATA SECTION
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_ FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 063 043 045 Old_age Always In_th e_past 37
請注意result後邊的結果:PASSED,這表示硬碟健康狀态良好,如果這裡顯示Failure,那麼最好立刻給伺服器更換硬碟。
SMART隻能報告磁盤已經不再健康,但是報警後還能繼續運作多久是不确定的,通常,SMART報警參數是有預留的,磁盤報警
後,不會當場壞掉,一般能堅持一段時間,有的硬碟SMART報警後還繼續跑了好幾年,有的硬碟SMART報錯後幾天就壞了
[root@c18p35 ~]# smartctl -A /dev/sda
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED R
AW_VALUE
\\ 1 Raw_Read_Error_Rate 0x000f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0003 189 186 021 Pre-fail Always - 5 516
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 8 5
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 200 200 051 Pre-fail Always - 0
9 Power_On_Hours 0x0032 067 067 000 Old_age Always - 2 4144
10 Spin_Retry_Count 0x0013 100 253 051 Pre-fail Always - 0
11 Calibration_Retry_Count 0x0012 100 253 051 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 8 5
190 Airflow_Temperature_Cel 0x0022 063 043 045 Old_age Always In_the_past 3 7
194 Temperature_Celsius 0x0022 113 093 000 Old_age Always - 3 7
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0012 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 200 200 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0009 200 200 051 Pre-fail Offline - 0
WHEN_FAILED 代表錯誤資訊,上面顯示的WHEN_FAILED縱行是空行,說明硬碟沒有故障。如果WHEN_FAILED顯示數字,表明硬
盤磁道可能有比較大的壞道。
[root@c18p35 ~]# smartctl -t short /dev/sda 背景檢測硬碟,消耗時間短
[root@c18p35 ~]# smartctl -t long /dev/sda 背景檢測硬碟,消耗時間長
[root@c18p35 ~]# smartctl -C -t short /dev/sda 前台檢測硬碟,消耗時間短
[root@c18p35 ~]# smartctl -C -t long /dev/sda 前台檢測硬碟,消耗時間長
[root@c18p35 ~]# smartctl -t long /dev/sda
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 90 minutes for test to complete.
Test will complete after Sun Jul 22 13:03:22 2012
Use smartctl -X to abort test.
上面的資訊顯示90分鐘後将完成檢查,同時可以使用 smartctl -X 終止檢查。
終止硬碟檢查指令的使用方法是:# smartctl -X /dev/sda
#smartctl -l selftest /dev/sda 顯示硬碟檢測日志。
#smartctl -l error /dev/sda 顯示硬碟錯誤彙總
本文轉自 xxl714 51CTO部落格,原文連結:http://blog.51cto.com/dreamgirl1314/981867,如需轉載請自行聯系原作者