Smartmontools-linux disk detection tool

Source: Internet
Author: User
1.1 What is Smartmontools?
Smartmontools is a hard disk detection tool that is implemented by controlling and managing the hard disk's SMART (Self Monitoring Analysis and Reporting Technology, automatic detection Analysis and Reporting Technology) Technology, SMART technology can monitor the Disk Head Unit, Drive System of Disk Motor, internal circuit of the disk, and media on the disk surface, when SMART detects and analyzes possible problems with the hard disk, it will promptly report an alarm to the user to avoid loss of computer data. SMART technology works only when the motherboard is supported, and SMART technology cannot predict all possible hard disk failures. SMART (SFF-8035i) is an industrial standard established by hard drive manufacturers. This standard is to store a table with properties such as execution, reliability, read error rate, and so on the hard drive. All attributes have a standard value of 1 byte (size range: 1-253), and contain another key stage value of 1 byte, if the data in the Attribute Table is close to less than or reaches the critical stage value, the hard disk is not working properly.

2.1 use of Smartmontools
1. Start the monitoring process

#/Etc/init. d/smartd start
Start smartd: [OK]
2. Check whether the hard disk supports the SMART technology after December 31,. you can run the following command to check whether the hard disk is released after December 31:

# Smartctl-I/dev/hdb
Smartctl version 5.33 [i686-turbo-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== Start of information section ====
Device Model: ST3160212A
Serial Number: 5LS2EDKN
Firmware Version: 3.AAE
User Capacity: 160,041,885,696 bytes
Device is: Not in smartctl database [for details use:-P showall]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Mon Sep 17 02:13:37 2007 CST
SMART support is: Available-device has SMART capability.
SMART support is: Enabled
The above information shows that the hard disk supports SMART technology and is currently enabled. If 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
3. Check the hard disk health status

# Smartctl-H/dev/hdb
Smartctl version 5.33 [i686-turbo-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
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 to 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 and the disk will not be broken on the spot after the alarm is triggered, it usually persists for a period of time. Some hard disk SMART will continue to run for several years after the alarm, and some hard disk SMART will break down in a few days after the error is reported. Never be lucky. Run the following command to view the detailed parameters:

# Smartctl-A/dev/hdb
Smartctl version 5.33 [i686-turbo-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 114 100 006 Pre-fail Always-81812244
3 Spin_Up_Time 0x0003 100 099 000 Pre-fail Always-0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always-257
5 Reallocated_Sector_Ct 0x0033 100 036 Pre-fail Always-0
7 Seek_Error_Rate 0x000f 078 060 030 Pre-fail Always-64781708
9 Power_On_Hours 0x0032 096 096 000 Old_age Always-4365
10 Spin_Retry_Count 0x0013 100 097 Pre-fail Always-0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always-276
187 Unknown_Attribute 0x0032 100 100 Old_age Always-0
189 unknown_attribute 0x003a 100 100 000 old_age always-0
190 unknown_attribute 0x0022 058 053 045 old_age always-773324842
194 temperature_celsius 0x0022 042 047 000 old_age always-42 (lifetime min/MAX 0/21)
195 hardware_ecc_recovered 0x001a 052 048 000 old_age always-1562815
197 current_pending_sector 0x0012 100 100 old_age always-0
198 offline_uncorrectable 0x0010 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 0x0032 100 000 old_age always-0
Flag is a flag, and the standard value should be smaller than or equal to the key value (thresh ). When_failed indicates the error message. The when_failed vertical line shown above is empty, indicating that the hard disk is not faulty. If when_failed shows a number, it indicates that the hard disk track may have a relatively large bad track.

4. There are four methods to manually test the hard disk:

Smartctl-T short <device> detects hard disks in the background, which takes a short time
Smartctl-t long <device> hard disk detection in the background, which takes a long time
Smartctl-c-t short <device> front-end hard disk detection, short time consumption
Smartctl-c-t long <device> front-end hard disk detection, which takes a long time
For example, to perform a detailed check on the hard disk in the background, the command is as follows:

# Smartctl-t long/dev/HDB
Smartctl version 5.33 [i686-turbo-linux-gnu] Copyright (c) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== 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 54 minutes for test to complete.
Test will complete after Mon Sep 17 03:53:32 2007

Use smartctl-X to abort test.
The above information shows that the check will be completed in 54 minutes, and you can use smartctl-X to terminate the check. The command to terminate the hard disk check is as follows:

# Smartctl-X/dev/hdb
Smartctl version 5.33 [i686-turbo-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== Start of offline immediate and self-test section ====
Sending command: "Abort SMART off-line mode self-test routine ".
Self-testing aborted!
5. Use "smartctl-l logtype <device>" to view hard disk logs. the logs are classified into multiple types, such as selftest and error. For example, you can view the hard disk Detection Log as follows:

# Smartctl-l selftest/dev/hdb
Smartctl version 5.33 [i686-turbo-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== 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 Extended offline Aborted by host 90% 4365-
#2 Extended offline Completed without error 00% 4247-
#3 Short offline Aborted by host 30% 4246-
#4 Short offline Aborted by host 10% 4246-
#5 Extended offline Completed without error 00% 4229-
View hard disk error logs:

# Smartctl-l error/dev/hdb
Smartctl version 5.33 [i686-turbo-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== Start of read smart data section ====
SMART Error Log Version: 1
No Errors Logged

I mainly want to see the power-on time
So we only use
Smartctl-A/dev/hda

Where
Power_On_Hours is the data I want

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.