硬盘健康状态

发布时间:2020-06-08 18:47:16 阅读:1230次

https://blog.csdn.net/jjwyll/article/details/54379453

http://fibrevillage.com/storage/57-smartctl-examples-to-get-smart-status-of-your-hard-drives

https://hiddenc0de.wordpress.com/2015/06/12/how-to-fix-bad-sectors-or-bad-blocks-on-hard-disk/


#smartctl --test=short /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-358.18.1.el6.x86_64] (local build)
Copyright (C) 2002-12 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 2 minutes for test to complete.
Test will complete after Tue Nov 26 00:12:00 2013
Use smartctl -X to abort test.
After 2 minutes, then use -a option to check self-test result
...
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%     17169         -
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
...
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-358.18.1.el6.x86_64] (local build)
Copyright (C) 2002-12 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 172 minutes for test to complete.
Test will complete after Tue Nov 26 03:08:29 2013
Use smartctl -X to abort test.


使用下面的命令来确认硬盘是否打开了SMART支持
复制代码
代码如下:
smartctl -i /dev/sda
正常情况下应该会得到下面这样的信息
复制代码
代码如下:
[root@localhost bbs]# smartctl -i /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-358.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar Blue Serial ATA
Device Model:     WDC WD5000AAKX-753CA1
Serial Number:    WD-WMAYUW928311
LU WWN Device Id: 5 0014ee 0034d871a
Firmware Version: 19.01H19
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Thu Jan 12 16:58:23 2017 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

在这里,如果看到SMART support is: Disabled,则表示SMART未启用

如果我们需要执行如下命令,启动SMART:

复制代码
代码如下:
smartctl –smart=on –offlineauto=on –saveauto=on /dev/sda
查看硬盘当前的健康状态使用如下命令

复制代码
代码如下:

[root@localhost ~]# smartctl -H /dev/sda
smartctl version 5.38 [i686-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is <a href="http://smartmontools.sourceforge.net/">http://smartmontools.sourceforge.net/</a>


复制代码
代码如下:

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
请注意result后边的结果:PASSED,这表示硬盘健康状态良好
如果这里显示Failure,那么最好立刻给服务器更换硬盘。

执行如下命令可以看到详细的参数:

复制代码
代码如下:

[root@localhost ~]# smartctl -A /dev/sda
smartctl version 5.38 [i686-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is <a href="http://www.jb51.net/">http://www.jb51.net/</a>

复制代码
代码如下:

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 100 253 006 Pre-fail Always – 0
3 Spin_Up_Time 0×0003 097 097 000 Pre-fail Always – 0
4 Start_Stop_Count 0×0032 100 100 020 Old_age Always – 818
5 Reallocated_Sector_Ct 0×0033 100 100 036 Pre-fail Always – 0
7 Seek_Error_Rate 0x000f 085 060 030 Pre-fail Always – 369003829
9 Power_On_Hours 0×0032 084 084 000 Old_age Always – 14527
10 Spin_Retry_Count 0×0013 100 100 097 Pre-fail Always – 0
12 Power_Cycle_Count 0×0032 100 100 020 Old_age Always – 817
187 Reported_Uncorrect 0×0032 100 100 000 Old_age Always – 0
189 High_Fly_Writes 0x003a 100 100 000 Old_age Always – 0
190 Airflow_Temperature_Cel 0×0022 052 046 045 Old_age Always – 48 (Lifetime Min/Max 47/52)
194 Temperature_Celsius 0×0022 048 054 000 Old_age Always – 48 (0 11 0 0)
195 Hardware_ECC_Recovered 0x001a 074 062 000 Old_age Always – 188295533
197 Current_Pending_Sector 0×0012 100 100 000 Old_age Always – 0
198 Offline_Uncorrectable 0×0010 100 100 000 Old_age Offline – 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always – 0
200 Multi_Zone_Error_Rate 0×0000 100 253 000 Old_age Offline – 0
202 TA_Increase_Count 0×0032 100 253 000 Old_age Always – 0
上边列出的参数表中可供进行技术分析和参考,使用下边的命令可以输出完整结果:

复制代码
代码如下:

smartctl -a /dev/sda

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:硬盘健康状态 出自老鄢博客 | 欢迎分享