Linux系统中的SMART(Self-Monitoring, Analysis, and Reporting Technology)是一种用于监控硬盘驱动器健康状况的技术。通过SMART,可以获取硬盘的详细信息,包括错误率、温度、通电时间等,从而预测硬盘可能出现的故障。
SMART是一种内置在硬盘驱动器中的诊断工具,它可以定期检查硬盘的健康状况,并记录关键参数。这些参数可以帮助用户了解硬盘的使用情况,及时发现潜在的问题。
SMART信息通常包括以下几类:
在Linux系统中,可以使用多种工具来查看SMART数据,常用的工具有smartctl
和hdparm
。
smartctl
smartctl
是smartmontools
包中的一个命令行工具,可以用来查看和管理SMART数据。
/dev/sda
是硬盘设备文件,根据实际情况替换为相应的设备文件。hdparm
hdparm
是一个用于硬盘参数设置的工具,也可以用来查看一些基本的SMART信息。
原因:可能是硬盘驱动器不支持SMART,或者SMART功能被禁用。
解决方法:
原因:可能是硬盘存在物理损坏或其他问题。
解决方法:
以下是一个使用smartctl
查看SMART数据的示例:
sudo smartctl -a /dev/sda
输出示例:
smartctl 7.2 2020-10-01 r5022 [x86_64-linux-5.4.0-77-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.19 (AF)
Device Model: ST3500418AS
Serial Number: Z1Z0980W
LU WWN Device Id: 5 000c50 075f8b8e6
Firmware Version: CC4B
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 7200 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is: Mon Oct 11 15:23:45 2021 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: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
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: (53956) 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.
No 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: ( 112) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.
SCT capabilities: (0x3035) 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 188 187 021 Pre-fail Always - 1046
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 57
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 098 098 000 Old_age Always - 3423
10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 57
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 31
193 Load_Cycle_Count 0x0032 197 197 000 Old_age Always - 31223
194 Temperature_Celsius 0x0022 110 108 000 Old_age Always - 35
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 200 200 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 3423
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 123456789
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 987654321
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 3423 -
# 2 Extended offline Completed without error 00% 3423 -
通过以上方法和工具,可以有效地监控和管理Linux系统中的硬盘健康状况。
领取专属 10元无门槛券
手把手带您无忧上云