linux硬盘检测健康状态

时间:2023-01-31 15:19:07

使用下面的命令来确认硬盘是否打开了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