当前位置:网站首页>硬盘监控和分析工具:Smartctl
硬盘监控和分析工具:Smartctl
2022-07-03 18:34:00 【星哥玩云】
Smartctl(S.M.A.R.T 自监控,分析和报告技术)是类Unix系统下实施SMART任务命令行套件或工具,它用于打印SMART自检和错误日志,启用并禁用SMRAT自动检测,以及初始化设备自检。
Smartctl对于Linux物理服务器十分有用,在这些服务器上,可以对智能磁盘进行错误检查,并将与硬件RAID相关的磁盘信息摘录下来。
在本帖中,我们将讨论smartctl命令的一些实用样例。如果你的Linux上海没有安装smartctl,请按以下步骤来安装。
使用Smartctl查Dell服务器坏道实录 http://www.linuxidc.com/Linux/2012-07/65723.htm
安装 Smartctl
对于 Ubuntu
- $ sudo apt-get install smartmontools
对于 CentOS & RHEL
- # yum install smartmontools
启动Smartctl服务
对于 Ubuntu
- $ sudo /etc/init.d/smartmontools start
对于 CentOS & RHEL
- # service smartd start ; chkconfig smartd on
样例
样例:1 检查磁盘的 Smart 功能是否启用
- [email protected]:~# smartctl -i /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF INFORMATION SECTION ===
- ModelFamily:SeagateMomentus5400.6
- DeviceModel: ST9320325AS
- SerialNumber:5VD2V59T
- LU WWN DeviceId:5000c50020a37ec4
- FirmwareVersion:0002BSM1
- UserCapacity:320,072,933,376 bytes [320 GB]
- SectorSize:512 bytes logical/physical
- RotationRate:5400 rpm
- Deviceis:In smartctl database [for details use:-P show]
- ATA Versionis: ATA8-ACS T13/1699-D revision 4
- SATA Versionis: SATA 2.6,1.5Gb/s
- LocalTimeis:SunNov1612:32:092014 IST
- SMART support is:Available- device has SMART capability.
- SMART support is:Enabled
这里‘/dev/sdb’是你的硬盘。上面输出中的最后两行显示了SMART功能已启用。
样例:2 启用磁盘的 Smart 功能
- [email protected]:~# smartctl -s on /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF ENABLE/DISABLE COMMANDS SECTION ===
- SMART Enabled.
样例:3 禁用磁盘的 Smart 功能
- [email protected]:~# smartctl -s off /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF ENABLE/DISABLE COMMANDS SECTION ===
- SMART Disabled.Use option -s with argument 'on' to enable it.
样例:4 显示磁盘的详细 Smart 信息
- [email protected]:~# smartctl -a /dev/sdb // For IDE drive
- [email protected]:~# smartctl -a -d ata /dev/sdb // For SATA drive
样例:5 显示磁盘总体健康状况
- [email protected]:~# smartctl -H /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF READ SMART DATA SECTION ===
- SMART overall-health self-assessment test result: PASSED
- Warning:This result is based on an Attribute check.
- Please note the following marginal Attributes:
- ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
- 190Airflow_Temperature_Cel0x0022067045045Old_ageAlwaysIn_the_past33(Min/Max25/33)
样例:6 使用long和short选项测试硬盘
Long测试
- [email protected]:~# smartctl --test=long/dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === 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 102 minutes for test to complete.
- Test will complete after SunNov1614:29:432014
- Use smartctl -X to abort test.
或者,我们可以重定向测试输出到日志文件,就像下面这样
- [email protected]:~# smartctl --test=long/dev/sdb >/var/log/long.text
Short测试
- [email protected]:~# smartctl --test=short/dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === 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 1 minutes for test to complete.
- Test will complete after SunNov1612:51:452014
- Use smartctl -X to abort test.
或
- [email protected]:~# smartctl --test=short/dev/sdb >/var/log/short.text
注意:short测试将花费最多2分钟,而在long测试中没有时间限制,因为它会读取并验证磁盘的每个段。
样例:7 查看驱动器的自检结果
- [email protected]:~# smartctl -l selftest /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF READ SMART DATA SECTION ===
- SMART Self-test log structure revision number 1
- NumTest_DescriptionStatusRemainingLifeTime(hours) LBA_of_first_error
- # 1 Short offline Completed: read failure 90% 492 210841222
- # 2 Extended offline Completed: read failure 90% 492 210841222
样例:8 计算测试时间估值
- [email protected]:~# smartctl -c /dev/sdb
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF READ SMART DATA SECTION ===
- General SMART Values:
- Offline data collection status:(0x00)Offline data collection activity
- was never started.
- AutoOfflineDataCollection:Disabled.
- Self-test execution status:(121)The previous self-test completed having
- the read element of the test failed.
- Total time to complete Offline
- data collection:(0) seconds.
- Offline data collection
- capabilities:(0x73) SMART execute Offline immediate.
- AutoOffline data collection on/off support.
- SuspendOffline collection upon new
- command.
- NoOffline surface scan supported.
- Self-test supported.
- ConveyanceSelf-test supported.
- SelectiveSelf-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.
- GeneralPurposeLogging supported.
- Shortself-test routine
- recommended polling time:(1) minutes.
- Extendedself-test routine
- recommended polling time:(102) minutes.
- Conveyanceself-test routine
- recommended polling time:(2) minutes.
- SCT capabilities:(0x103b) SCT Status supported.
- SCT ErrorRecoveryControl supported.
- SCT FeatureControl supported.
- SCT DataTable supported.
样例:9 显示磁盘错误日志
- [email protected]:~# smartctl -l error /dev/sdb
- SampleOutput
- smartctl 6.22013-07-26 r3841 [x86_64-linux-3.13.0-32-generic](local build)
- Copyright(C)2002-13,BruceAllen,ChristianFranke, www.smartmontools.org
- === START OF READ SMART DATA SECTION ===
- SMART ErrorLogVersion:1
- ATA ErrorCount:5
- CR =CommandRegister[HEX]
- FR =FeaturesRegister[HEX]
- SC =SectorCountRegister[HEX]
- SN =SectorNumberRegister[HEX]
- CL =CylinderLowRegister[HEX]
- CH =CylinderHighRegister[HEX]
- DH =Device/HeadRegister[HEX]
- DC =DeviceCommandRegister[HEX]
- ER =Errorregister[HEX]
- ST =Statusregister[HEX]
- Powered_Up_Timeis measured from power on,and printed as
- DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
- SS=sec,and sss=millisec.It"wraps" after 49.710 days.
- Commands leading to the command that caused the error were:
- CR FR SC SN CL CH DH DC Powered_Up_TimeCommand/Feature_Name
- ----------------------------------------------------
- 25 da 08 e7 e5 a5 4c0000:30:44.515 READ DMA EXT
- 25 da 08 df e5 a5 4c0000:30:44.514 READ DMA EXT
- 25 da 805f e5 a5 4c0000:30:44.502 READ DMA EXT
- 25 da f0 5f e6 a5 4c0000:30:44.496 READ DMA EXT
- 25 da 104f e6 a5 4c0000:30:44.383 READ DMA EXT
边栏推荐
- Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download
- 圖像24比特深度轉8比特深度
- Change the single node of Postgres database into master-slave
- Coordinate layer conversion tool (video)
- Count the number of pixel values in the image
- JS_ Array_ sort
- An academic paper sharing and approval system based on PHP for computer graduation design
- Should I be laid off at the age of 40? IBM is suspected of age discrimination, calling its old employees "dinosaurs" and planning to dismiss, but the employees can't refute it
- [combinatorics] generating function (example of generating function | calculating generating function with given general term formula | calculating general term formula with given generating function)
- 图像24位深度转8位深度
猜你喜欢

English grammar_ Adjective / adverb Level 3 - multiple expression

Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download
![网格图中递增路径的数目[dfs逆向路径+记忆dfs]](/img/57/ff494db248171253996dd6c9110715.png)
网格图中递增路径的数目[dfs逆向路径+记忆dfs]

Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
![AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]](/img/3d/6d61fefc62063596221f98999a863b.png)
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]

2022-2028 global copper foil (thickness 12 μ M) industry research and trend analysis report

English grammar_ Noun classification

Read the paper glodyne global topology preserving dynamic network embedding

Module 9 operation

How to expand the capacity of golang slice slice
随机推荐
Sepconv (separable revolution) code recurrence
204. Count prime
041. (2.10) talk about manpower outsourcing
Bidding procurement scheme management of Oracle project management system
Zero length array
Boost. Asio Library
Enterprise custom form engine solution (12) -- form rule engine 2
How about the Moco model?
Prototype inheritance..
English语法_名词 - 分类
English grammar_ Adjective / adverb Level 3 - multiple expression
[combinatorics] generating function (example of using generating function to solve the number of solutions of indefinite equation)
Reading a line from ifstream into a string variable
CTO and programmer were both sentenced for losing control of the crawler
Win 11 major updates, new features love love.
There are several levels of personal income tax
How to track the real-time trend of Bank of London
Software development freelancer's Road
PHP determines which constellation it belongs to today
2022-2028 global lithium battery copper foil industry research and trend analysis report