In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use Smartctl to monitor disk performance in Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Smartctl to monitor disk performance in Linux.
Smartctl (S.M.A.R.T self-Monitoring, Analysis and reporting Technology) is a command line kit or tool for implementing SMART tasks on Unix-like systems. It is used to print SMART self-test and error logs, enable and disable SMRAT automatic detection, and initialize device self-test.
Smartctl is useful for Linux physical servers, where you can error check smart disks and extract disk information related to hardware RAID.
In this post, we will discuss some practical examples of the smartctl command. If your Linux Shanghai does not have smartctl installed, please follow these steps to install it.
Install Smartctl
For Ubuntu
The code is as follows:
$sudo apt-get install smartmontools
For CentOS & RHEL
The code is as follows:
# yum install smartmontools
Start the Smartctl service
For Ubuntu
The code is as follows:
$sudo / etc/init.d/smartmontools start
For CentOS & RHEL
The code is as follows:
# service smartd start; chkconfig smartd on
Sample
Example: 1 check whether the Smart function of the disk is enabled
The code is as follows:
Root@linuxtechi:~# smartctl-I / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= START OF INFORMATION SECTION = =
Model Family: Seagate Momentus 5400.6
Device Model: ST9320325AS
Serial Number: 5VD2V59T
LU WWN Device Id: 5 000c50 020a37ec4
Firmware Version: 0002BSM1
User Capacity: 320072933376 bytes [320 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 5400 rpm
Device is: In smartctl database [for details use:-P show]
ATA Version is: ATA8-ACS T13amp 1699MuthD revision 4
SATA Version is: SATA 2.6, 1.5 Gb/s
Local Time is: Sun Nov 16 12:32:09 2014 IST
SMART support is: Available-device has SMART capability.
SMART support is: Enabled
Here'/ dev/sdb' is your hard drive. The last two lines of the output above show that the SMART feature is enabled.
Example: 2 enable the Smart function of disk
The code is as follows:
Root@linuxtechi:~# smartctl-s on / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= START OF ENABLE/DISABLE COMMANDS SECTION = =
SMART Enabled.
Example: 3 disable the Smart function of disk
The code is as follows:
Root@linuxtechi:~# smartctl-s off / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= START OF ENABLE/DISABLE COMMANDS SECTION = =
SMART Disabled. Use option-s with argument 'on' to enable it.
Example: 4 displays the detailed Smart information of the disk
The code is as follows:
Root@linuxtechi:~# smartctl-a / dev/sdb / / For IDE drive
Root@linuxtechi:~# smartctl-a-d ata / dev/sdb / / For SATA drive
Example: 5 shows the overall health of the disk
The code is as follows:
Root@linuxtechi:~# smartctl-H / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, 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
190 Airflow_Temperature_Cel 0x0022 067,045,045 Old_age Always In_the_past 33 (Min/Max 25 Universe 33)
Example: 6 Test the hard drive using the long and short options
Long test
The code is as follows:
Root@linuxtechi:~# smartctl-test=long / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, 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 Sun Nov 16 14:29:43 2014
Use smartctl-X to abort test.
Alternatively, we can redirect the test output to the log file, like this
The code is as follows:
Root@linuxtechi:~# smartctl-- test=long / dev/sdb > / var/log/long.text
Short test
The code is as follows:
Root@linuxtechi:~# smartctl-test=short / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, 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 Sun Nov 16 12:51:45 2014
Use smartctl-X to abort test.
Or
The code is as follows:
Root@linuxtechi:~# smartctl-- test=short / dev/sdb > / var/log/short.text
Note: the short test will take up to 2 minutes, but there is no time limit in the long test because it reads and validates each segment of the disk.
Example: 7 View the self-test results of the drive
The code is as follows:
Root@linuxtechi:~# smartctl-l selftest / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= 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: read failure 90% 492 210841222
# 2 Extended offline Completed: read failure 90% 492 210841222
Example: 8 calculate the test time estimate
The code is as follows:
Root@linuxtechi:~# smartctl-c / dev/sdb
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= START OF READ SMART DATA SECTION = =
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
Was never started.
Auto Offline Data Collection: 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.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
Command.
No 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: (1) minutes.
Extended self-test routine
Recommended polling time: (102) minutes.
Conveyance self-test routine
Recommended polling time: (2) minutes.
SCT capabilities: (0x103b) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.
Example: 9 shows disk error log
The code is as follows:
Root@linuxtechi:~# smartctl-l error / dev/sdb
Sample Output
Smartctl 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
= START OF READ SMART DATA SECTION = =
SMART Error Log Version: 1
ATA Error Count: 5
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is 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_Time Command/Feature_Name
-
25 da 08 e7 e5 a5 4c 00 00:30:44.515 READ DMA EXT
25 da 08 df e5 a5 4c 00 00:30:44.514 READ DMA EXT
25 da 80 5f e5 a5 4c 00 00:30:44.502 READ DMA EXT
25 da f0 5f e6 a5 4c 00 00:30:44.496 READ DMA EXT
25 da 10 4f e6 a5 4c 00 00:30:44.383 READ DMA EXT
At this point, I believe you have a deeper understanding of "how to use Smartctl to monitor disk performance in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.