注意:查看硬盘通电时间只对独服有效,vps是无效的
Ubuntu / Debian:
apt install smartmontools
smartctl -A /dev/sda
CentOS:
yum install smartmontools
smartctl -A /dev/sda
如果你的独服挂载了多块硬盘,其中 /dev/sda
是硬盘编号,第一块一般是 /dev/sda
,如果有多块硬盘,第二块就是 /dev/sdb
,最后一个字母按照abcdefg,以此类推。不过一般大家的独服都只有一到两块硬盘啦!
一般我们会看到如下的输出:
cnhb43013ds ~ # smartctl -A /dev/sda
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-5-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org
=== 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 RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 142 142 054 Pre-fail Offline - 68
3 Spin_Up_Time 0x0007 123 123 024 Pre-fail Always - 185 (Average 187)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 40
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 115 115 020 Pre-fail Offline - 34
9 Power_On_Hours 0x0012 098 098 000 Old_age Always - 16857
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 40
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 131
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 131
194 Temperature_Celsius 0x0002 181 181 000 Old_age Always - 33 (Min/Max 22/44)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
找到9开头那一行也就是这行↓
9 Power_On_Hours 0x0012 098 098 000 Old_age Always - 16857
最后面的16857就是硬盘通电时间了,单位为小时,我这台16857小时还算可以。其实通电时间5w小时以下都算健康的!