Monitor your hard drive-advance prediction system SMART

Source: Internet
Author: User
Article title: Monitor your hard drive-advance prediction system SMART. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Abstract: what people are most afraid of is not to install a system, but to install it after hard work, suddenly one day the hard disk is broken, and there is no backup (DAT, DLT and other such tape drives are too expensive ). How can we know if your hard drive will last the new year? (What is the hard disk status ?) Especially if we can forecast in advance and tell everyone that the hard drive is too hard to withstand, how nice it would be.
  
Test environment FreeBSD and Debian
  
Solution:
  
   SMART
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, your hard disk will be almost lost with you, at least it exceeds its design limit-backup and worst-case calculation should be performed.
  
SFF-8035i industrial standards go through ATA-3, ATA-4 to ATA-5, adding an error log and a series of hard drive self-tested SMART commands. SMART adaptation with IDE and SCSI hard drives.
  
I have performed experiments with FreeBSD 5.2 and Debian. they are both good. you can use atactl directly in OpenBSD. let's take a look at man atactl. Other linux systems are fine.
  
   Install smartmontools
FreeBSD:
  
#/Usr/ports/sysutils/smartmontools
# Make install clean
# Cp/usr/local/etc/rc. d/smartd. sh. sample/usr/local/etc/rc. d/smartd. sh
# Cp/usr/local/etc/smartd. conf. sample/usr/local/etc/smartd. conf
# Chmod 555/usr/local/etc/rc. d/smartd. sh
  
Debian:
Apt-get install smartmontool *
/Etc/smartd. conf
  
FreeBSD setting file/usr/local/etc/smartd. conf
Debian setting file/etc/smartd. conf
  
Note:
  
Never forget to rewrite the settings file !!!!
The first IDE hard disk under FreeBSD is ad0 and the SCSI hard disk is da0.
The first IDE hard disk in Debian is/dev/hda, and the SCSI hard disk is/dev/sda.
  
Next I will use FreeBSD as an example. my hard disk is IDE. if you are using SCSI, you will go to the official website for query.
  
   Start the monitoring program:
/Usr/local/etc/rc. d/smartd. sh start
  
First, let's see if your hard drive supports SMART:
  
Bash-2.05b # smartctl-I/dev/ad0
  
Smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== Start of information section ====
Device Model: IBM-DJSA-220
Serial Number: 44K443Z0103
Firmware Version: JS4OAC3A
Device is: Not in smartctl database [for details use:-P showall]
ATA Version is: 5
ATA Standard is: ATA/ATAPI-5 T13 1330d revision 1
Local Time is: Mon Dec 22 21:04:38 2003 CET
SMART support is: Available-device has SMART capability.
SMART support is: enable
  
The smart return status return value (smartmontools-H option/Directive)
Can not be retrieved with this version of ATAng, please do not rely on this value
  
Check my disk health test. if your self-assessment test result is FAILING
It's finished. back up now !!!
  
Bash-2.05b # smartctl-Hc/dev/ad0
  
Smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

The smart return status return value (smartmontools-H option/Directive)
Can not be retrieved with this version of ATAng, please do not rely on
This value
=== Start of read smart data section ====
SMART overall-health self-assessment test result: PASSED
  
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
Was
Never started.
Auto Offline Data Collection: Disabled.
  
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: (650) seconds.
Offline data collection
Capabilities: (0x1b) SMART execute Offline immediate.
Auto Offline data collection on/off
Support.
Suspend Offline collection
New
Command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
No 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.
No General Purpose Logging support.
Short self-test routine
Recommended polling time: (2) minutes.
Extended self-test routine
Recommended polling time: (29) minutes.
  
The attribute information given in the following table varies with your hard drive vendor. The most important thing is to understand the meaning of each vertical line: If there is a standard VALUE (VALUE) when the value is smaller than or equal to the key value (THRESH), the WHEN_FAILED line will provide information, and the WHEN_FAILED vertical line is empty, indicating that it is okay. If WHEN_FAILED reports an error, the hard disk is faulty .... WORST is the minimum VALUE of the standard VALUE.
  
Bash-2.05b # smartctl-A/dev/ad0
Smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

The smart return status return value (smartmontools-H option/Directive)
Can not be retrieved with this version of ATAng, please do not rely on
This value
=== Start of read smart data section ====
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 0x000b 100 100 062 Pre-fail Always
-0
2 Throughput_Performance 0x0005 100 040 Pre-fail Offline
-0
3 Spin_Up_Time 0x0007 113 033 Pre-fail Always
-1
4 Start_Stop_Count 0x0012 100 000 Old_age Always
-985
5 Reallocated_Sector_Ct 0x0033 100 005 Pre-fail Always
-0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always
-0
8 Seek_Time_Performance 0x0005 100 040 Pre-fail Offline
-0
9 Power_On_Hours 0x0012 097 097 000 Old_age Always
-1642
10 Spin_Retry_Count 0x0013 100 060 Pre-fail Always
-0
12 Power_Cycle_Count 0x0032 100 000 Old_age Always
-914
191 G-Sense_Error_Rate 0x000a 100 100 000 Old_age Always
-0
192 Power-Off_Retract_Count 0x0032 100 000 Old_age Always
-8
193 Load_Cycle_Count 0x0012 096 096 050 Old_age Always
-45262
196 Reallocated_Event_Count 0x0032 100 000 Old_age Always
-17
197 Current_Pending_Sector 0x0022 100 100 Old_age Always
-1
198 Offline_Uncorrectable 0x0008 100 000 Old_age Offline
-0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always
-0
  
The following Command provides the hard disk error log. I will not give it because of the length.
Smartctl-l error/dev/ad0
  
The following command gives the hard disk self-test
  
Smartctl-l selftest/dev/ad0
  
Stop hard disk test.
  
Smartctl-X/dev/ad0
  
Suggestion: rewrite the settings file smartd. conf. there is a "-m" option that is very useful, it can send information to you by mail.
  
   Edit postscript:
SMART reminds you, but cannot back up your data. To truly enable SMART to serve you, you should read and write smartd & smartd. conf annotations, so that the background program will remind you (mail) of some key values to reach dangerous areas under certain circumstances, the commands provided above are manual tests when you begin to feel bad.

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.