首先使用下面的命令来确认硬盘是否打开了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
查看硬盘当前的健康状态使用如下命令:
smartctl -H /dev/sda
结果如下:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
请注意result后边的结果:PASSED,这表示硬盘健康状态良好
如果这里显示Failure,那么最好立刻给服务器更换硬盘。
查看硬盘通电时间,输入以下命令:
smartctl -A /dev/sda
显示结果:
=== 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
其中Power_On_Hours 14527 就代表通电时间为14527小时