CentOSsmartctl hard disk detection

Source: Internet
Author: User
What is S. m. a. r. t. SMART is a disk self-analysis and detection technology. as early as the end of 1990s, SMART was widely used when every hard disk (including IDE and SCSI) was running, several parameters of the hard disk are recorded, including the model, capacity, temperature, density, sector, track time, transmission, and error rate, many internal physical parameters change. if a parameter exceeds the alarm threshold, the hard disk is still working when it is close to damage. if the user ignores this alarm, the hard disk will become very

What is S. M.A. R. T.
SMART is a disk self-analysis and detection technology, which was popularized as early as the end of 1990s.
Several parameters of each hard disk (including IDE and SCSI) are recorded during operation.
These parameters include model, capacity, temperature, density, sector, track time, transmission, error rate, etc.
After the hard disk has been running for thousands of hours, many internal physical parameters will change.
If a parameter exceeds the alarm threshold, the hard disk is near damaged.
At this time, the hard disk is still working. if you ignore this alarm, continue to use it.
The hard disk becomes very unreliable and may fail at any time.

Enable SMART
SMART works with the corresponding features on the BIOS of the motherboard.
To use SMART, you must first enter the BIOS settings of the motherboard to start the settings.
Generally, the motherboard from Pentium2 supports SMART
After the BIOS is started, it is about the operating system level.
Unfortunately, Windows does not have built-in SMART tools (third-party tool software is required)
Fortunately, SMART support has been available for Linux for a long time.
If you install Linux on a virtual machine such as VMware, you can see a service startup error during system startup: smartd
This server is the smart daemon process (because the hard disk of vmwarevm does not support SMART, an error is reported)

First, use the dmesg tool to confirm the device symbol of the hard disk.
For example, if an IDE hard disk is connected to the Slave location on the Primary IDE bus, the hard disk device symbol is/dev/hdb.
H in hdb indicates IDE. if it is sdb, it indicates SATA and SCSI.
The last Subtitle B represents the Primary bus, and the second hard disk is the Slave location.

Check whether SMART support is enabled for the hard disk.
Smartctl-I/dev/hdb

For example, the following returned results are displayed:
[Root@3.6.0Biz-46 ~] # Smartctl-I/dev/hdb
Smartctl version 5.33 [i386-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== Start of information section ====
Device Model: ST380011A
Serial Number: 3 JVAPRGH
Firmware Version: 3.04
User Capacity: 80,026,361,856 bytes
Device is: In smartctl database [for details use:-P show]
ATA Version is: 6
ATA Standard is: ATA/ATAPI-6 T13 1410D revision 2
Local Time is: Tue Apr 3 15:39:52 2007 CST
SMART support is: Available? Device has SMART capability.
SMART support is: Disabled
SMART Disabled. Use option-s with argument 'on' to enable it.
[Root@3.6.0Biz-46 ~] #
We can see that SMART support is: Disabled indicates that SMART is not enabled.

Run the following command to start SMART:
Smartctl? Smart = on? Offlineauto = on? Saveauto = on/dev/hdb

For example, the following returned results are displayed:
[Root@3.6.0Biz-46 ~] # Smartctl? Smart = on? Offlineauto = on? Saveauto = on/dev/hdb
Smartctl version 5.33 [i386-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== Start of enable/disable commands section ===
SMART Enabled.
SMART Attribute Autosave Enabled.
SMART Automatic Offline Testing Enabled every four hours.
[Root@3.6.0Biz-46 ~] #
Now the SMART feature of the hard disk has been enabled

Run the following command to check the health status of the hard disk:
Smartctl-H/dev/hda
For example, you can see the following results:
[Root@3.6.0Biz-46 ~] # Smartctl-H/dev/hdb
Smartctl version 5.33 [i386-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== Start of read smart data section ====
SMART overall-health self-assessment test result: PASSED
[Root@3.6.0Biz-46 ~] #
Note the result following the result: PASSED, which indicates that the hard disk is in good health.
If Failure is displayed, it is best to change the hard disk of the server immediately.
SMART can only report that the disk is no longer healthy, but it is not clear how long it will continue to run after the alarm
Generally, the SMART alarm parameter is reserved. after a disk alarm is triggered, it will not be broken on the spot. generally, it can last for a period of time.
Some SMART hard disks continue to run for several years after the alarm, and some SMART hard disks will crash in a few days after an error is reported.
However, once an alarm is triggered, you are lucky to be unable ......

Run the following command to view the detailed parameters:
Smartctl-A/dev/hdb
For example, you can see the following results:
[Root@3.6.0Biz-46 ~] # Smartctl-A/dev/hdb
Smartctl version 5.33 [i386-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== Start of read smart data section ====
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID # ATTRIBUTE_NAME flag value worst thresh type updated WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 053 051 006 Pre-fail Always? 11338710
3 Spin_Up_Time 0x0003 098 097 000 Pre-fail Always? 0
4 Start_Stop_Count 0 × 0032 100 100 020 Old_age Always? 17
5 Reallocated_Sector_Ct 0 × 0033 100 100 036 Pre-fail Always? 0
7 Seek_Error_Rate 0x000f 087 060 030 Pre-fail Always? 610059516
9 Power_On_Hours 0x0032 087 087 000 Old_age Always? 11974
10 Spin_Retry_Count 0x0013 100 097 Pre-fail Always? 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always? 110
194 Temperature_Celsius 0x0022 045 052 000 Old_age Always? 45
195 Hardware_ECC_Recovered 0x001a 053 051 000 Old_age Always? 11338710
197 Current_Pending_Sector 0 × 0012 100 100 000 Old_age Always? 0
198 Offline_Uncorrectable 0 × 0010 100 100 Old_age Offline? 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always? 0
200 Multi_Zone_Error_Rate 0x0000 100 000 Old_age Offline? 0
202 TA_Increase_Count 0 × 0032 100 253 000 Old_age Always? 0
[Root@3.6.0Biz-46 ~] #
The parameters listed above can be used for technical analysis and reference. you can use the following command to output the complete results:
Smartctl-a/dev/hdb

Regular logon to the server is troublesome to run smartctl. linux provides the system process smartd.
Edit the configuration file:
Vi/etc/smartd. conf
Most of this configuration file may be commented out. you only need to write a row related to the current hard disk correctly:
/Dev/hdb-H-m test@test123123.com
The above configuration indicates that smartd works in silent state, and ignores it when PASSED is reported in SMART.
Once a Failure occurs, you can immediately notify the user of the specified email address by email.
Modify the configuration and restart the service:
/Etc/init. d/smartd
You can complete all SMART configurations.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.