smartmontools
硬盘设备:指定要查看的硬盘(可以使用 fdisk -l 获取有哪些硬盘设备)
~ sudo fdisk -l
设备 起点 末尾 扇区 大小 类型
/dev/sda1 2048 1050623 1048576 512M EFI 系统
查看 /dev/sda1 硬盘特定的属性和值 (Power_On_Hours: 表示通电时长 18195 小时)
~ sudo smartctl -A /dev/sda1
=== START OF READ SMART DATA SECTION ===
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
3 Spin_Up_Time 0x0023 100 100 002 Pre-fail Always - 1326
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 3752
9 Power_On_Hours 0x0032 055 055 000 Old_age Always - 18195
10 Spin_Retry_Count 0x0033 174 100 030 Pre-fail Always - 0
184 End-to-End_Error 0x0033 100 100 097 Pre-fail Always - 0
185 Unknown_Attribute 0x0032 100 100 001 Old_age Always - 65535
187 Reported_Uncorrect 0x0032 001 001 000 Old_age Always - 134
188 Command_Timeout 0x0032 100 098 000 Old_age Always - 48
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 2850
192 Power-Off_Retract_Count 0x0022 100 100 000 Old_age Always - 32047593
193 Load_Cycle_Count 0x0032 095 095 000 Old_age Always - 51738
下一步,编辑smartd的配置文件(/etc/smartd.conf),添加以下行内容。
/dev/sda -m myemail@mydomain.com -M test
保存改动并重启smartd。