参考:Acronis Drive Monitor: Disk Health Calculation
文章目录
- 1、背景
- 2、smartctl -a /dev/sda
- 3、计算健康值
-
- 4、附录
- 表1 关键属性的阈值和权重
- 表2 其它影响健康值的参数
1、背景
需要监控硬盘精确的健康值。
我们知道smartctl工具可以实现对硬盘的健康检测,但是并没有给出具体的健康值信息。
例如,smartctl -H /dev/sda命令可以检测硬盘:
~
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-12-2-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
~
SMART overall-health self-assessment test result: PASSED 说明检查通过。能说明基本的监控状态,但是不包含精确的健康值信息。
2、smartctl -a /dev/sda
实际上,smartctl工具能监控到关于硬盘健康度的所有信息:
~
省略部分信息……
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID
1 Raw_Read_Error_Rate 0x0000 100 100 000 Old_age Offline - 0
5 Reallocated_Sector_Ct 0x0000 100 100 000 Old_age Offline - 0
9 Power_On_Hours 0x0000 100 100 000 Old_age Offline - 52
12 Power_Cycle_Count 0x0000 100 100 000 Old_age Offline - 59
160 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 0
161 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 158
163 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 7
164 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 6313
165 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 8
166 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 0
167 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 3
168 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 3000
169 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 100
175 Program_Fail_Count_Chip 0x0000 100 100 000 Old_age Offline - 0
176 Erase_Fail_Count_Chip 0x0000 100 100 000 Old_age Offline - 0
177 Wear_Leveling_Count 0x0000 100 100 050 Old_age Offline - 0
178 Used_Rsvd_Blk_Cnt_Chip 0x0000 100 100 000 Old_age Offline - 0
181 Program_Fail_Cnt_Total 0x0000 100 100 000 Old_age Offline - 0
182 Erase_Fail_Count_Total 0x0000 100 100 000 Old_age Offline - 0
192 Power-Off_Retract_Count 0x0000 100 100 000 Old_age Offline - 2
194 Temperature_Celsius 0x0000 100 100 000 Old_age Offline - 39
195 Hardware_ECC_Recovered 0x0000 100 100 000 Old_age Offline - 0
196 Reallocated_Event_Count 0x0000 100 100 016 Old_age Offline - 0
197 Current_Pending_Sector 0x0000 100 100 000 Old_age Offline - 0
198 Offline_Uncorrectable 0x0000 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0000 100 100 050 Old_age Offline - 0
232 Available_Reservd_Space 0x0000 100 100 000 Old_age Offline - 100
241 Total_LBAs_Written 0x0000 100 100 000 Old_age Offline - 5141
242 Total_LBAs_Read 0x0000 100 100 000 Old_age Offline - 1575
245 Unknown_Attribute 0x0000 100 100 000 Old_age Offline - 12626
3、计算健康值
3.1 关键参数
3.1.1 公式说明
所有 smartctl监控到的S.M.A.R.T.参数,都是对硬盘驱动器至关重要的参数(是否支持监控这些参数,取决于硬盘制造商)。通过这些参数可以计算出硬盘运行情况和健康值。 监控到的属性具有规范的预定义的权重和最大限值(参见附录表 1)。
属性的限值定义了属性可能会降低整体健康值的程度。 属性的权重定义了参数值降低受影响磁盘健康值的重要性。
公式:
Disk health (%) = П (100% - (min(limit, attribute_value*Weight)))
参数说明:
- 100% - 磁盘初始的健康值;
- limit - 每个S.M.A.R.T. 属性的限值 (参看附录表1);
- attribute_value -利用工具监控到的,属性的当前值;
- Weight - 每个S.M.A.R.T. 属性的权重 (参看附录表1);
- П - 累乘符号,所有关键属性通过公式
100% - (min(limit, attribute_value*Weight))
计算出的值相乘;
3.2.2 计算举例
举个简化的例子,包含两个参数:
- Soft Read Error Rate = 30 (attribute value), 查表得weight = 1, limit = 20;
- Spin Retry Count = 12 (attribute value), 查表得weight = 2, limit = 50.
按照公式计算的健康值:
Disk health = (100% – (min(30*1, 20))) * (100-min(12*2, 50))) = 80%*76%=60.8%
3.2 其它参数
其他的一些 S.M.A.R.T. 属性(参看附录表2),若磁盘制造商针对这些属性定义了阈值(THRESH列),这些参数也会影响到健康值的计算:当某项属性低于阈值后,则将3.1中计算的Disk health
值减去减去 10%。
例如:
若Disk health = 90%
,如果某项属性低于阈值,则减去90%的10%,最终Disk health = 90% - 9% = 81%
。
4、附录
表1 关键属性的阈值和权重
Attribute ID | S.M.A.R.T. attribute | Weight | Limit % |
---|
05 | Reallocated Sectors Count | 2 | 70 |
10 | Spin Retry Count | 2 | 50 |
184 | End-to-End Error | 1 | 50 |
196 | Reallocation Event Count | 1 | 40 |
197 | Current Pending Sectors Count | 1 | 40 |
198 | Offline uncorrectable Sectors Count | 2 | 70 |
201 | Soft Read Error Rate | 1 | 20 |
表2 其它影响健康值的参数
Attribute ID | S.M.A.R.T. attribute |
---|
01 | Raw Read Error Rate |
02 | Throughput Performance |
03 | Spin Up Time |
04 | Start/Stop Count |
07 | Seek Error Rate |
08 | Seek Time Performance |
09 | Power-On Time Count |
12 | Drive Power Cycle Count |
221 | G-Sense Error Rate |
228 | Power Off Retract Cycle |
225 | Load/Unload Cycle Count |
194 | Disk Temperature |
199 | Ultra ATA CRC Error Count |
193 | Load/Unload Retry Count |
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)