linux查看磁盘SMART
原创大约 4 分钟
linux查看磁盘SMART
hdparm
是用于管理和查看硬盘设置的工具,但它本身并不直接提供硬盘使用总时间的统计。如果你想检查硬盘使用的总时间(比如硬盘启动以来的累计运行时间),通常需要通过 S.M.A.R.T. 功能来查看硬盘的相关信息。
启用 S.M.A.R.T. 功能并查看硬盘信息:
使用smartctl
工具,它通常附属于smartmontools
包,可以检查硬盘的健康状况及运行时间。安装
smartmontools
(如果尚未安装):sudo apt-get install smartmontools
检查硬盘运行时间:
使用smartctl
来查看硬盘的运行时间。sudo smartctl -a /dev/sdX
其中
/dev/sdX
是你的硬盘设备名称(如/dev/sda
)。输出中寻找类似以下的字段:
9 Power_On_Hours -O--CK 100 100 000 - 12345
Power_On_Hours
字段表示硬盘启动以来累计的运行时间,以小时为单位。查看其他信息:
sudo smartctl -a /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-122-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Re
Device Model: WDC WD2004FBYZ-01YCBB1
Serial Number: WD-WMC6N0D35JYP
LU WWN Device Id: 5 0014ee 059931253
Firmware Version: RR04
User Capacity: 2,000,398,934,016 bytes [2.00 TB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-3 T13/2161-D revision 5
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Sep 24 11:17:23 2024 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 0) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 219) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.
SCT capabilities: (0x003d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.
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 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 181 181 021 Pre-fail Always - 3916
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 15
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0
9 Power_On_Hours 0x0032 027 027 000 Old_age Always - 53941
10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 15
16 Total_LBAs_Read 0x0022 000 200 000 Old_age Always - 34557144962
183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 8
193 Load_Cycle_Count 0x0032 200 200 000 Old_age Always - 63
194 Temperature_Celsius 0x0022 118 106 000 Old_age Always - 29
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
重要部分的解析:
1. 基本信息
- 硬盘型号: WDC WD2004FBYZ-01YCBB1(Western Digital 2TB 硬盘)
- 序列号: WD-WMC6N0D35JYP
- 容量: 2.00 TB
- 转速: 7200 RPM
- 固件版本: RR04
- SATA 版本: SATA 3.1, 6.0 Gb/s
2. SMART 支持
- SMART 支持: 已启用,设备有 SMART 功能,并且正在使用。
- 健康检查结果: 通过 (PASSED) —— 硬盘整体健康状况良好,没有发现严重问题。
3. SMART 属性
这是 SMART 的一些关键属性,它们帮助预测潜在的硬盘故障:
Raw_Read_Error_Rate (原始读取错误率):
- 值: 200 (良好),没有读取错误。
Spin_Up_Time (启动时间):
- 值: 181 (正常),启动时间为 3916 ms。
Start_Stop_Count (启动/停止计数):
- 硬盘已启动 15 次。
Reallocated_Sector_Ct (重新分配扇区数):
- 没有重新分配的扇区(0)。
Seek_Error_Rate (寻道错误率):
- 没有寻道错误(0)。
Power_On_Hours (通电小时数):
- 硬盘已经运行了 53941 小时(约 6.16 年)。
Power_Cycle_Count (电源循环次数):
- 硬盘电源循环了 15 次。
Temperature_Celsius (温度):
- 当前温度为 29 摄氏度,良好。
Reallocated_Event_Count (重新分配事件数):
- 没有重新分配事件(0)。
Current_Pending_Sector (当前待定扇区数):
- 没有待定扇区(0)。
Offline_Uncorrectable (离线无法纠正的扇区数):
- 没有无法纠正的扇区(0)。
UDMA_CRC_Error_Count (UDMA CRC 错误计数):
- 没有数据传输错误(0)。
4. 自检和错误日志
- 没有记录任何错误日志,也没有运行自检。可以运行
smartctl -t
来手动执行自检。