说明:此方法只适用于独服!!
方法
这里用的centos系统:
yum install smartmontools -y
如果有阵列使用命令:
smartctl -a /dev/sg0
smartctl -a /dev/sg1
smartctl -a /dev/sg2
sg1是阵列卡
如果就普通硬盘没有阵列使用命令:
smartctl -A /dev/sda #如果不行用df看看硬盘名称,把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 0 × 000f 083 063 044 Pre-fail Always – 204269687
3 Spin_Up_Time 0 × 0003 099 099 000 Pre-fail Always – 0
4 Start_Stop_Count 0 × 0032 100 100 020 Old_age Always – 18
5 Reallocated_Sector_Ct 0 × 0033 100 100 036 Pre-fail Always – 0
7 Seek_Error_Rate 0 × 000f 069 060 030 Pre-fail Always – 7825289
9 Power_On_Hours 0 × 0032 099 099 000 Old_age Always – 1626
10 Spin_Retry_Count 0 × 0013 100 100 097 Pre-fail Always – 0
12 Power_Cycle_Count 0 × 0032 100 037 020 Old_age Always – 18
184 Unknown_Attribute 0 × 0032 100 100 099 Old_age Always – 0
187 Reported_Uncorrect 0 × 0032 100 100 000 Old_age Always – 0
188 Unknown_Attribute 0 × 0032 100 099 000 Old_age Always – 12
189 High_Fly_Writes 0 × 003a 100 100 000 Old_age Always – 0
190 Airflow_Temperature_Cel 0 × 0022 072 069 045 Old_age Always – 28 (Lifetime Min/Max 25/31)
194 Temperature_Celsius 0 × 0022 028 040 000 Old_age Always – 28 (0 22 0 0)
195 Hardware_ECC_Recovered 0 × 001a 050 047 000 Old_age Always – 204269687
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 0 × 003e 200 200 000 Old_age Always – 0
其中 Power_On_Hours 就是硬盘使用小时了,如果是 Power_On_Minutes 就是硬盘使用分钟,例如:
9 Power_On_Minutes 0 × 0032 201 201 000 Old_age Always – 649h+23m