在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
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 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
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 READ SMART DATA SECTION
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
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 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 显示硬盘错误汇总
转载于:https://blog.51cto.com/dreamgirl1314/981867