设为首页收藏本站

ZMX - IT技术交流论坛 - 无限Perfect,追求梦想 - itzmx.com

 找回密码
 注册论坛

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

用百度帐号登录

只需两步,快速登录

搜索
查看: 2604|回复: 1

Linux下centos使用smartctl 检测独立物理服务器SSD硬盘型号和Smart信息 机械磁盘坏道,09通电时间

[复制链接]
 成长值: 255

签到天数: 4710 天

[LV.Master]伴坛终老

发表于 2017/11/26 01:03 | 显示全部楼层 |阅读模式 |Google Chrome 60.0.3112.113|Windows 10
天涯海角搜一下: 百度 谷歌 360 搜狗 有道 雅虎 必应 即刻
Linux下centos使用smartctl 检测独立物理服务器SSD硬盘型号和Smart信息 机械磁盘坏道,09通电时间

安装
  1. yum -y install smartmontools
复制代码


检查磁盘的 Smart 功能是否启用,/dev/sda为你的磁盘,一般都是这个,可以通过df -h查看输出的磁盘是什么。
  1. smartctl -i /dev/sda
复制代码


返回如下信息
smartctl 5.43 2016-09-28 r4347 [x86_64-linux-2.6.32-431.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue
Device Model:     WDC WD10EZEX-08WN4A0
Serial Number:    WD-WCC6Y4FCKJ0U
LU WWN Device Id: 5 0014ee 2643ffa4a
Firmware Version: 01.01A01
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ACS-3 (unknown minor revision code: 0x001f)
Local Time is:    Sat Nov 25 11:35:41 2017 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


上面输出中的最后两行显示了SMART功能已启用
根据你的需求进行选择是否启用或者禁用SMART功能。
启用磁盘的 Smart 功能
  1. smartctl -s on /dev/sda
复制代码

禁用磁盘的 Smart 功能
  1. smartctl -s off /dev/sda
复制代码


显示通电时间
  1. smartctl -a /dev/sda | grep Power_On_Hours
复制代码


显示磁盘信息,一个IDE,一个SATA,看哪个能用就哪个,输出内容是一样的
  1. smartctl -a /dev/sda
复制代码
  1. smartctl -a -d ata /dev/sda
复制代码

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x85)        Offline data collection activity
                                        was aborted by an interrupting command from host.
                                        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:                 (11100) 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:          ( 115) minutes.
Conveyance self-test routine
recommended polling time:          (   5) minutes.
SCT capabilities:                (0x3035)        SCT Status 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   100   253   021    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       1
  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   099   099   000    Old_age   Always       -       1423
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       -       1
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       0
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       21
194 Temperature_Celsius     0x0022   115   112   000    Old_age   Always       -       28
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
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      1423         -
# 2  Short offline       Completed without error       00%      1423         -
# 3  Extended offline    Aborted by host               90%      1423         -

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.



显示磁盘总体自检健康状况,例如查看坏扇区数量,显示FAILED就要注意啦
  1. smartctl -H /dev/sda
复制代码
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED


手动使用long和short选项测试硬盘坏道
long完整测试,预计大概115分钟,测试结果后台自动执行,过一段时间查看即可。
  1. smartctl --test=long /dev/sda 2>&1 | tee long.log
复制代码
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 115 minutes for test to complete.
Test will complete after Sat Nov 25 13:42:37 2017

Use smartctl -X to abort test.


Short快速测试,预计大概2分钟,测试结果后台自动执行,过一段时间查看即可。
  1. smartctl --test=short /dev/sda 2>&1 | tee short.log
复制代码
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Sat Nov 25 11:55:30 2017

Use smartctl -X to abort test.


查看驱动器的自检测试坏道结果
  1. smartctl -l selftest /dev/sda
复制代码
=== START OF READ SMART DATA SECTION ===
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%      1423         -
# 2  Extended offline    Aborted by host               90%      1423         -



计算测试时间估值
  1. smartctl -c /dev/sda
复制代码
=== START OF READ SMART DATA SECTION ===
General SMART Values:
Offline data collection status:  (0x85)        Offline data collection activity
                                        was aborted by an interrupting command from host.
                                        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:                 (11100) 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:          ( 115) minutes.
Conveyance self-test routine
recommended polling time:          (   5) minutes.
SCT capabilities:                (0x3035)        SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.


显示磁盘错误日志
  1. smartctl -l error /dev/sda
复制代码
=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
No Errors Logged


欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复

使用道具 举报

签到天数: 1165 天

[LV.10]以坛为家III

发表于 2017/11/26 13:58 | 显示全部楼层 |Google Chrome 27.0.1453.93|Windows 7
标·
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册论坛 新浪微博账号登陆用百度帐号登录

本版积分规则

手机版|Archiver|Mail me|网站地图|IT技术交流论坛 ( 闽ICP备13013206号-7 )

GMT+8, 2024/11/26 06:22 , Processed in 0.100706 second(s), 20 queries , MemCache On.

Powered by itzmx! X3.4

© 2011- sakura

快速回复 返回顶部 返回列表