问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

Windows 如何获取硬盘 smart 信息

创作时间:
作者:
@小白创作中心

Windows 如何获取硬盘 smart 信息

引用
1
来源
1.
https://www.modb.pro/db/1782940069933944832

硬盘的S.M.A.R.T.(Self-Monitoring Analysis and Reporting Technology,自我监测分析与报告技术)信息是一种用于监控硬盘健康状况的技术。它可以检测硬盘的潜在故障,以便用户及时备份数据并更换硬盘。本文将介绍如何在Windows系统中获取硬盘的S.M.A.R.T.信息。

硬盘的S.M.A.R.T.信息(Self-Monitoring Analysis and Reporting Technology,自我监测分析与报告技术)是一种用于监控硬盘健康状况的技术。它可以检测硬盘的潜在故障,以便用户及时备份数据并更换硬盘。

一般使用第三方工具检测硬盘smart信息,比如:

  • smartmontools
  • DiskGenius
  • hdtune

其中smartmontools是命令行工具,Windows、Linux都支持。DiskGenius是国产工具,hdtune是国外工具,它俩都有免费版。

先看下DiskGenius显示的smart信息:

其中有用数据有:

------------------------------------
     TOSHIBA Q300. 240.0 GB
------------------------------------
序列号: 46JB3210KC9U
通电时间: 10904 小时
通电次数: 441
温度: 32 ℃

使用smartmontools工具也可以获得类似的信息:

C:\> smartctl -a dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-w64-mingw32-w10-22H2] (sf-7.4-1)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model:     TOSHIBA Q300.
Serial Number:    46JB3210KC9U
LU WWN Device Id: 5 00080d c004475e1
Firmware Version: SAFM12.3
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        Not in smartctl database 7.3/5528
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Tue Apr 23 17:10:59 2024
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
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
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       10904
 12 Power_Cycle_Count       0x0012   100   100   000    Old_age   Always       -       441
167 Unknown_Attribute       0x0022   100   100   000    Old_age   Always       -       0
168 Unknown_Attribute       0x0012   100   100   000    Old_age   Always       -       0
169 Unknown_Attribute       0x0003   100   100   010    Pre-fail  Always       -       0
173 Unknown_Attribute       0x0012   199   199   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0012   100   100   000    Old_age   Always       -       69
194 Temperature_Celsius     0x0023   068   054   020    Pre-fail  Always       -       32 (Min/Max 8/46)

smartmontools获取地址:

https://www.smartmontools.org/

另外有一个Python库对smartmontools的数据做了处理,可以单独获取指定值:

C:\> pip install pySMART
from pySMART import Device, DeviceList
# 获取所有硬盘的列表
devices = DeviceList()
# 打印每个硬盘的SMART信息
for device in devices:
    print("Device:", device.name)
    print("Model:", device.model)
    print("Serial:", device.serial)
    print("Size:", device.size_raw)
    print("SMART attributes:")
    for attribute in device.attributes:
        if attribute and attribute.name != 'Unknown_Attribute':
            print("  {}: {}".format(attribute.name, attribute.raw))

Python脚本运行效果为:

d:\>python getSmart.py
Device: sda
Model: TOSHIBA Q300.
Serial: 46JB3210KC9U
Size: 240 GB
SMART attributes:
  Power_On_Hours: 10904
  Power_Cycle_Count: 441
  Power-Off_Retract_Count: 69
  Temperature_Celsius: 31 (Min/Max 8/46)

硬盘smart信息里没有硬盘出厂日期,硬盘出厂日期只能通过硬盘外部的贴纸获取,也可以基于序列号在硬盘品牌的官网查询。通过smart信息可以估算出硬盘的使用频率,比如通电时长、启停次数、异常断电次数。

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号