四川做网站的公司有哪些,上市的网站设计公司,网络设计公司有哪些,引导型网站设计一、命令简介
smartctl 命令用于获取硬盘的 SMART 信息。
介绍硬盘SMART
硬盘的 SMART (Self-Monitoring, Analysis, and Reporting Technology) 技术用于监控硬盘的健康状态#xff0c;并能提供一些潜在故障的预警信息。通过查看 SMART 数据#xff0c;用户可以了解硬…一、命令简介
smartctl 命令用于获取硬盘的 SMART 信息。
介绍硬盘SMART
硬盘的 SMART (Self-Monitoring, Analysis, and Reporting Technology) 技术用于监控硬盘的健康状态并能提供一些潜在故障的预警信息。通过查看 SMART 数据用户可以了解硬盘的各种属性和状态如错误率、温度、使用寿命等。
安装smartctl
sudo install smartmontools
检查硬盘的 SMART 状态
sudo smartctl -a /dev/sda更详细的用例请参考后继章节
与硬盘相关命令
gdisk、fdisk 命令磁盘分区管理。mkfs 命令格式化。mdadm 命令管理软 RAID。lsblk 命令列出块设备包含磁盘信息。df 命令磁盘余量smartctl 命令读取磁盘 SMART 信息
二、命令参数
格式
smartctl 选项 硬盘需要sudo权限运行。
选项
-a, --all显示所有 SMART 信息。-H, --health显示硬盘的健康状态。-i, --info显示硬盘的基本信息。-l selftest显示自检结果。-t test启动自检如 short短自检或 long长自检。-c, --capabilities显示硬盘的 SMART 能力。-x, --xall显示扩展 SMART 信息。-l error显示错误日志。-A, --attributes显示 SMART 属性。-s, --smarton|off启用或禁用 SMART 功能。-d, --deviceTYPE指定硬盘的接口类型如 ata, scsi, sat, nvme 等。
参数
/dev/sdX指定要检查的硬盘设备路径如 /dev/sda。test自检类型如 short, long。TYPE硬盘接口类型如 ata, scsi, sat, nvme。
三、命令示例
显示硬盘的基本信息
sudo smartctl -i /dev/sdX输出
显示硬盘的 SMART 属性
sudo smartctl -A /dev/sdX输出
souliok455l:~$ sudo smartctl -A /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.5.0-35-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org START OF READ SMART DATA SECTION
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_VALUE1 Raw_Read_Error_Rate 0x002f 100 100 051 Pre-fail Always - 62 Throughput_Performance 0x0027 252 252 000 Pre-fail Always - 03 Spin_Up_Time 0x0023 095 091 025 Pre-fail Always - 16514 Start_Stop_Count 0x0032 096 096 000 Old_age Always - 44785 Reallocated_Sector_Ct 0x0033 252 252 010 Pre-fail Always - 07 Seek_Error_Rate 0x002f 252 252 051 Pre-fail Always - 08 Seek_Time_Performance 0x0025 252 252 015 Pre-fail Offline - 09 Power_On_Hours 0x0032 100 100 000 Old_age Always - 1228410 Spin_Retry_Count 0x0033 252 252 051 Pre-fail Always - 011 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 17512 Power_Cycle_Count 0x0032 097 097 000 Old_age Always - 3057
181 Program_Fail_Cnt_Total 0x0022 100 100 000 Old_age Always - 9022488
183 Runtime_Bad_Block 0x0032 252 252 010 Old_age Always - 0
184 End-to-End_Error 0x0033 252 252 048 Pre-fail Always - 0
186 Unknown_Attribute 0x0032 252 252 000 Old_age Always - 0
187 Reported_Uncorrect 0x0032 252 252 000 Old_age Always - 0
188 Command_Timeout 0x0032 252 252 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0002 066 050 040 Old_age Always - 34 (Min/Max 8/50)
191 G-Sense_Error_Rate 0x0022 100 100 000 Old_age Always - 77
192 Power-Off_Retract_Count 0x0022 100 100 000 Old_age Always - 79
193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 1103480
194 Temperature_Celsius 0x0002 064 050 000 Old_age Always - 34 (Min/Max 8/50)
195 Hardware_ECC_Recovered 0x003a 100 100 000 Old_age Always - 0
196 Reallocated_Event_Count 0x0032 252 252 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 252 252 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 252 252 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0036 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x002a 100 100 000 Old_age Always - 1663启动短自检
sudo smartctl -t short /dev/sdX输出
souliok455l:~$ sudo smartctl -t /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.5.0-35-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org INVALID ARGUMENT TO -t: /dev/sdbVALID ARGUMENTS ARE: offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off] Use smartctl -h to get a usage summary获取硬盘温度
sudo smartctl -a /dev/sdX | grep Temperature输出
启用 SMART 功能
sudo smartctl -s on /dev/sdX默认就是打开的。
指明硬盘类型
有时我们使用 USB 外挂的硬盘使用 smartctl 命令可能会提示“无法识别磁盘类型”。需要使用 -d 参数手动指明硬盘类型比如 sat 类型。
$ sudo smartctl -d sat -a /dev/sdc | grep Temperature190 Airflow_Temperature_Cel 0x0022 058 047 045 Old_age Always - 42 (Min/Max 18/42)
194 Temperature_Celsius 0x0022 042 053 000 Old_age Always - 42 (0 4 0 0 0)