SMARTCTL(8)

NAME
smartctl - S.M.A.R.T. control and monitor utility

SYNOPSIS
smartctl [options] device

DESCRIPTION
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (S.M.A.R.T.) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of S.M.A.R.T. is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests. This version of smartctl is compatible with ATA/ATAPI-5 and earlier standards (see REFERENCES below) smartctl is a command line utility designed to perform S.M.A.R.T. tasks such as printing the S.M.A.R.T. self-test and error logs, and enabling and disabling S.M.A.R.T. automatic testing. Note: if the user issues a S.M.A.R.T. command that is (apparently) not implemented by the device, smartctl will print a warning message but issue the command anyway. This should not cause problems: unimplemented S.M.A.R.T. commands issued to a drive are ignored and return an error. smartctl also provides limited TapeAlerts support for some SCSI tape drives and changers. The user must specify the device to be controlled or interrogated as the final argument to smartctl. ATA devices use the form "/dev/hd*" and SCSI devices use the form "/dev/sd*". For SCSI Tape Drives and Changers with TapeAlerts support use the devices "/dev/st*" and "/dev/sg*". More general paths may also be specified. smartctl will attempt to guess the device type, but the '-d' option can be used to specify a device type of ATA or SCSI if required. Note that the printed output of smartctl displays most numerical values in base 10 (decimal), but some values are displayed in base 16 (hexidecimal). To distinguish them, the base 16 values are always displayed with a leading 0x for example: "0xff". This convention is also followed in this man page.

OPTIONS

The options are grouped below into several categories. smartctl will execute the corresponding commands in the order: INFORMATION, ENABLE/DISABLE, DISPLAY DATA, RUN/ABORT TESTS. SCSI devices only accept the options -h, -?, -V, -i, -a, -d, -s, -H, -t, -C -l selftest and -X. TapeAlerts devices only accept the options -h, -?, -V, -i, -a, -d, -s and -H. Long options are not supported on all systems. Use 'smartctl -h' to see the available options.

SHOW INFORMATION:

-h, --help, --usage
    Prints a usage message to STDOUT and exits.

-?  Same as -h.

-V, --version, --copyright, --license
    Prints version, copyright, license, home page and CVS-id information for your copy of smartctl to STDOUT and then exits. Please include this information if you are reporting bugs or problems.

-i, --info
    Prints the disk model number, serial number, firmware version, and ATA Standard version/revision information. Says if the device supports S.M.A.R.T., and if so, whether S.M.A.R.T. support is currently enabled or disabled.

-a, --all
    Prints all S.M.A.R.T. information about the disk. This is equivalent to '-H -i -c -A -l error -l selftest' (for SCSI, '-H -i -l selftest').

RUN-TIME BEHAVIOR:

-q TYPE, --quietmode=TYPE
    Specifies that smartctl should run in one of the two quiet modes described here. The valid arguments to this option are: errorsonly - only print: For the '-l error' option, if nonzero, the number of errors recorded in the SMART error log and the power-on time when they occurred; For the '-l selftest' option, errors recorded in the device self-test log; For the '-H' option, SMART "disk failing" status or device Attributes (pre-failure or usage) which failed either now or in the past; For the '-A' option, device Attributes (pre-failure or usage) which failed either now or in the past. silent - print no output. The only way to learn about what was found is to use the exit status of smartctl (see RETURN VALUES below).

-d TYPE, --device=TYPE
    Specifies the type of the device. The valid arguments to this option are ata and scsi. If this option is not used then smartctl will attempt to guess the device type from the device name.

-T TYPE, --tolerance=TYPE
    Specifies how tolerant smartctl should be of S.M.A.R.T. command failures. The valid arguments to this option are: normal - exit on failure of a mandatory S.M.A.R.T. command, but not on failure of an optional S.M.A.R.T. command. This is the default. conservative - exit on failure of any S.M.A.R.T. command. permissive - ignore failure of any S.M.A.R.T. command. Here "mandatory" means "required by the ATA/ATAPI-5 Specification if the device implements the S.M.A.R.T. command set" and "optional" means "not required by the ATA/ATAPI-5 Specification even if the device implements the S.M.A.R.T. command set." The 'mandatory' S.M.A.R.T. commands are: (1) Enable/Disable Attribute Autosave, (2) Enable/Disable S.M.A.R.T., and (3) S.M.A.R.T. Return Status.

-b TYPE, --badsum=TYPE
    Specifies the action smartctl should take if a checksum error is detected in the: (1) Device Identity Structure, (2) S.M.A.R.T. Self-Test Log Structure, (3) S.M.A.R.T. Attribute Value Structure, (4) S.M.A.R.T. Attribute Threshold Structure, or (5) ATA Error Log Structure. The valid arguments to this option are: warn - report the incorrect checksum but carry on in spite of it. This is the default. exit - exit smartctl. ignore - continue silently without issuing a warning.

S.M.A.R.T. FEATURE ENABLE/DISABLE COMMANDS:

    Note: if multiple options are used to both enable and disable a feature, then both the enable and disable commands will be issued. The enable command will always be issued before the corresponding disable command.

-s VALUE, --smart=VALUE
    Enables or disables S.M.A.R.T. on device. The valid arguments to this option are on and off. Note that the command '-s on' (perhaps used with with the '-o on' and '-S on' options) should be placed in a start-up script for your machine, for example in rc.local or rc.sysinit. In principle the S.M.A.R.T. feature settings are preserved over power-cycling, but it doesn't hurt to be sure.

-o VALUE, --offlineauto=VALUE
    Enables or disables S.M.A.R.T. automatic offline test, which scans the drive every four hours for disk defects. This command can be given during normal system operation. The valid arguments to this option are on and off. Note that the S.M.A.R.T. automatic offline test command is listed as 'Obsolete' in every version of the ATA and ATA/ATAPI Specifications that I can find. However it is implemented and used by some vendors. [Good documentation can be found in IBM's Official Published Disk Specifications. For example the IBM Travelstar 40GNX Hard Disk Drive Specifications (Revision 1.1, 22 April 2002, Publication # 1541, Document S07N-7715-02) page 164.] S.M.A.R.T. provides three basic categories of testing. The first category, called 'online' testing, has no effect on the performance of the device. It is turned on by the '-s on' option. The second category of testing is called 'offline' testing. This type of test can, in principle, degrade the device performance. The '-o on' option causes this offline testing to be carried out, automatically, on a regular scheduled basis. Normally, the disk will suspend offline testing while disk accesses are taking place, and then automatically resume it when the disk would otherwise be idle, so in practice it has little effect. Note that a one-time offline test can also be carried out immediately upon receipt of a user command. See the '-t offline' option below, which causes a one-time offline test to be carried out immediately. Any errors detected in automatic or immediate offline testing are reflected in the values of the S.M.A.R.T. Attributes; some types of errors may also appear in the S.M.A.R.T. error log. These are visible with the '-A' and '-l error' options respectively. The third category of testing is the 'self' testing. This third type of test is only performed (immediately) when a command to run it is issued. The '-t' and '-X' options can be used to carry out and abort such self-tests; please see below for further details. Any errors detected in the self testing will be shown in the S.M.A.R.T. self-test log, which can be examined using the '-l selftest' option. Note: in this manual page, the word Test is used in connection with the second category just described, e.g. for the 'offline' testing. The words Self-test are used in connection with the third category.

-S VALUE, --saveauto=VALUE
    Enables or disables S.M.A.R.T. autosave of device vendor-specific Attributes. The valid arguments to this option are on and off. Note that this feature is preserved across disk power cycles, so you should only need to issue it once.

S.M.A.R.T. READ AND DISPLAY DATA OPTIONS:

-H, --health
    Check: Ask the device to report its S.M.A.R.T. health status. It does this using information that it has gathered from online and offline tests, which were used to determine/update its S.M.A.R.T. vendor-specific Attribute values. If the device reports failing health status, this means either that the device has already failed, or that it is predicting its own failure within the next 24 hours. If this happens, use the '-a' option to get more information, and get your data off the disk and someplace safe as soon as you can.

-c, --capabilities
    Prints only the generic S.M.A.R.T. capabilities. These show what S.M.A.R.T. features are implemented and how the device will respond to some of the different S.M.A.R.T. commands. For example it shows if the device logs errors, if it supports offline surface scanning, and so on. If the device can carry out self-tests, this option also shows the estimated time required to run those tests. Note that the time required to run the Self-tests (listed in minutes) are fixed. However the time required to run the Immediate Offline Test (listed in seconds) is variable. This means that if you issue a command to perform an Immediate Offline test with the '-t offline' option, then the time may jump to a larger value and then count down as the Immediate Offline Test is carried out. Please see REFERENCES below for further information about the the flags and capabilities described by this option.

-A, --attributes
    Prints only the vendor specific S.M.A.R.T. Attributes. The Attributes are numbered from 1 to 253 and have specific names. For example Attribute 12 is 'power cycle count': how many times has the disk been powered up. Each Attribute has a 'Raw' value, printed under the heading 'RAW_VALUE', and a 'Normalized' value printed under the heading 'VALUE'. [Note: smartctl prints these values in base-10.] In the example just given, the 'Raw Value' for Attribute 12 would be the actual number of times that the disk has been power-cycled, for example 365 if the disk has been turned on once per day for exactly one year. Each vendor uses their own magic to convert this Raw value to a Normalized value in the range from 1 to 254. Note that the conversion from 'Raw' value to a quantity with physical units is not specified by the S.M.A.R.T. standard. In most cases, the values printed by smartctl are sensible. For example the temperature Attribute generally has its raw value equal to the temperature in Celsius. However in some cases vendors use unusual conventions. For example the Hitachi disk on my laptop reports its power-on hours in minutes, not hours. Some IBM disks track three temperatures rather than one, in their raw values. And so on. Each Attribute also has a Threshold value (whose range is 0 to 255) which is printed under the heading 'THRESH'. If the Normalized value is less than or equal to the Threshold value, then disk failure is imminent. Each Attribute also has a 'Worst' value shown under the heading 'WORST'. This is the smallest (closest to failure) value that the disk has recorded at any time during its lifetime when S.M.A.R.T. was enabled. [Note however that some vendors will have firmware which will increase the 'Worst' value for some "rate-type" Attributes.] The Attribute table printed out by smartctl also shows the 'Type' of the Attribute. Pre-failure Attributes are ones which, if less than or equal to their threshold values, indicate pending disk failure. Old age, or usage Attributes, are ones which indicate end-of-product life from old-age or normal aging and wearout, if the Attribute value is less than or equal to the threshold. If the Attribute's current Normalized value is <= threshold, then the 'Ever failed' column will display 'FAILED NOW!'. If not, but the worst recorded value is <= threshold, then this column will display 'In the past'. Note that starting with ATA/ATAPI-4, revision 4, the meaning of these Attribute fields has been made entirely vendor-specific. However most ATA/ATAPI-5 disks seem to respect their meaning, so we have retained the option of printing the Attribute values.

-l TYPE, --log=TYPE
    Prints either the S.M.A.R.T. error log or the S.M.A.R.T. self-test log. The valid arguments to this option are: error - prints only the S.M.A.R.T. error log. S.M.A.R.T. disks maintain a log of the most recent five non-trivial errors. For each of these errors, the disk power-on lifetime at which the error occurred is recorded, as is the device status (idle, standby, etc) at the time of the error. Finally, up to the last five commands that preceded the error are also recorded, along with a timestamp measured in seconds from when the disk was powered up during the session where the error took place. [Note: this time stamp wraps after 2^32 milliseconds, or 49 days 17 hours 2 minutes and 47.296 seconds.] The key ATA disk registers are also recorded in the log. selftest - prints only the S.M.A.R.T. self-test log. The disk maintains a log showing the results of the self tests, which can be run using the '-t' option described below. For each of the most recent twenty-one self-tests, the log shows the type of test (short or extended, off-line or captive) and the final status of the test. If the test did not complete successfully, then the percentage of the test remaining is shown. The time at which the test took place, measured in hours of disk lifetime, is also printed. If any errors were detected, the Logical Block Address (LBA) of the first error is printed in hexadecimal notation. selftest [SCSI] - the self-test log for a SCSI device has a slightly different format than for an ATA device. For each of the most recent twenty self-tests, it shows the type of test and the status (final or in progress) of the test. SCSI standards use the terms 'foreground' and 'background' (rather than ATA's corresponding 'captive' and 'off-line') and 'short' and 'long' (rather than ATA's corresponding 'short' and 'extended') to describe the type of the test. The printed segment number is only relevant when a test fails in the third or later test segment. It identifies the test that failed and consists of either the number of the segment that failed during the test, or the number of the test that failed and the number of the segment in which the test was run, using a vendor-specific method of putting both numbers into a single byte. The Logical Block Address (LBA) of the first error is printed in hexadecimal notation. If provided, the SCSI Sense Key (SK), Additional Sense Code (ASC) and Additional Sense Code Qualifier (ASQ) are also printed. The self tests can be run using the '-t' option described below (using the ATA test terminology).

-v N,OPTION, --vendorattribute=N,OPTION
    Sets a vendor-specific display OPTION for Attribute N. Valid arguments to this option are: help - Prints (to STDOUT) a list of all valid arguments to this option, then exits. 9,minutes - Raw Attribute number 9 is power-on time in minutes. Its raw value will be displayed in the form 'Xh+Ym'. Here X is hours, and Y is minutes in the range 0-59 inclusive. Y is always printed with two digits, for example '06' or '31' or '00'. 9,temp - Raw Attribute number 9 is the disk temperature in Celsius. 220,temp - Raw Attribute number 220 is the disk temperature in Celsius. A table of hard drive models, listing which Attribute corresponds to temperature, can be found at: http://coredump.free.fr/linux/hddtemp.db

S.M.A.R.T. RUN/ABORT OFFLINE TEST AND SELF-TEST OPTIONS:

-t TEST, --test=TEST
    Executes TEST immediately. The '-C' option can be used in conjunction with this option to run the short or long self-tests in captive mode (known as 'foreground mode' for SCSI devices). Note that only one test can be run at a time, so this option should only be used once per command line. The valid arguments to this option are: offline - runs S.M.A.R.T. Immediate Offline Test. This immediately starts the test described above. This command can be given during normal system operation. The effects of this test are visible only in that it updates the S.M.A.R.T. Attribute values, and if errors are found they will appear in the S.M.A.R.T. error log, visible with the '-l error' option. If the '-c' option to smartctl shows that the device has the "Suspend Offline collection upon new command" capability then you can track the progress of the Immediate Offline test using the '-c' option to smartctl. If the '-c' option show that the device has the "Abort Offline collection upon new command" capability then most commands will abort the Immediate Offline Test, so you should not try to track the progress of the test with '-c', as it will abort the test. short - runs S.M.A.R.T. Short Self Test (usually under ten minutes). [Note: in the case of SCSI devices, this command option runs the 'Background short' self-test.] This command can be given during normal system operation (unless run in captive mode - see the '-C' option below). This is a test in a different category than the immediate or automatic offline tests. The 'Self' tests check the electrical and mechanical performance as well as the read performance of the disk. Their results are reported in the Self Test Error Log, readable with the '-l selftest' option. Note that on some disks the progress of the self-test can be monitored by watching this log during the self-test; with other disks use the '-c' option to monitor progress. long - runs S.M.A.R.T. Extended Self Test (tens of minutes). [Note: in the case of SCSI devices, this command option runs the 'Background long' self-test.] This is a longer and more thorough version of the Short Self Test described above. Note that this command can be given during normal system operation (unless run in captive mode - see the '-C' option below).

-C, --captive
    With '-t short' or '-t long', runs the self-test in captive mode. This has no effect with '-t offline' or if the '-t' option is not used. [Note: in the case of SCSI devices, this command option runs the self-test in 'Foreground' mode.] WARNING: Tests run in captive mode may busy out the drive for the length of the test. Only run captive tests on drives without any mounted partitions!

-X, --abort
    Aborts non-captive S.M.A.R.T. Self Tests. Note that this command will abort the Offline Immediate Test routine only if your disk has the "Abort Offline collection upon new command" capability.

EXAMPLES
smartctl -a /dev/hda
Print all S.M.A.R.T. information for drive /dev/hda (Primary Master).

smartctl -s off /dev/hdd
Disable S.M.A.R.T. on drive /dev/hdd (Secondary Slave).

smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda
Enable S.M.A.R.T. on drive /dev/hda, enable automatic offline testing every four hours, and enable autosaving of S.M.A.R.T. Attributes. This is a good start-up line for your system's init files. You can issue this command on a running system.

smartctl -t long /dev/hdc
Begin an extended self-test of drive /dev/hdc. You can issue this command on a running system. The results can be seen in the self-test log visible with the '-l selftest' option after it has completed.

smartctl -s on -t offline /dev/hda
Enable S.M.A.R.T. on the disk, and begin an immediate offline test of drive /dev/hda. You can issue this command on a running system. The results are only used to update the S.M.A.R.T. Attributes, visible with the '-A' option. If any device errors occur, they are logged to the S.M.A.R.T. error log, which can be seen with the '-l error' option.

smartctl -A -v 9,minutes /dev/hda
Shows the vendor Attributes, when the disk stores its power-on time internally in minutes rather than hours.

smartctl -q errorsonly -H -l selftest /dev/hda
Produces output only if the device returns failing S.M.A.R.T. status, or if some of the logged self-tests ended with errors.

smartctl -q silent -a /dev/hda
Examine all S.M.A.R.T. data for device /dev/hda, but produce no printed output. You must use the exit status (the $? shell variable) to learn if any Attributes are out of bound, if the S.M.A.R.T. status is failing, if there are errors recorded in the self-test log, or if there are errors recorded in the disk error log.

RETURN VALUES
The return values of smartctl are defined by a bitmask. For the moment this only works on ATA disks. The different bits in the return value are as follows:

Bit 0:
    Command line did not parse.

Bit 1:
    Device open failed, or device did not return an IDENTIFY DEVICE structure.

Bit 2:
    Some SMART command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above).

Bit 3:
    SMART status check returned "DISK FAILING".

Bit 4:
    SMART status check returned "DISK OK" but we found prefail Attributes <= threshold.

Bit 5:
    SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.

Bit 6:
    The device error log contains records of errors.

Bit 7:
    The device self-test log contains records of errors. To test within the shell for whether or not the different bits are turned on or off, you can use the following type of construction (this is bash syntax):
    smartstat=$(($? & 8))
    This looks at only at bit 3 of the exit status $? (since 8=2^3). The shell variable $smartstat will be nonzero if SMART status check returned 'disk failing' and zero otherwise.

AUTHOR
Bruce Allen smartmontools-support@lists.sourceforge.net
University of Wisconsin - Milwaukee Physics Department

CREDITS
This code was derived from the smartsuite package, written by Michael Cornwell, and from the previous ucsc smartsuite package. It extends these to cover ATA-5 disks. This code was originally developed as a Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory (now part of the Storage Systems Research Center), Jack Baskin School of Engineering, University of California, Santa Cruz. http://ssrc.soe.ucsc.edu/.

HOME PAGE FOR SMARTMONTOOLS:
Please see the following web site for updates, further documentation, bug reports and patches:
http://smartmontools.sourceforge.net/

SEE ALSO:
smartd (8)

REFERENCES FOR S.M.A.R.T.
If you would like to understand better how S.M.A.R.T. works, and what it does, a good place to start is Section 8.41 of the 'AT Attachment with Packet Interface-5' (ATA/ATAPI-5) specification. This documents the S.M.A.R.T. functionality which the smartmontools utilities provide access to. You can find Revision 1 of this document at:
http://www.t13.org/project/d1321r1c.pdf
Future versions of the specifications (ATA/ATAPI-6 and ATA/ATAPI-7), and later revisions (2, 3) of the ATA/ATAPI-5 specification are available from:
http://www.t13.org/#FTP_site
The functioning of S.M.A.R.T. is also described by the SFF-8035i revision 2 specification. This is a publication of the Small Form Factors (SFF) Committee, and can be obtained from:

    SFF Committee
    14426 Black Walnut Ct.
    Saratoga, CA 95070, USA
    SFF FaxAccess: +01 408-741-1600
    Ph: +01 408-867-6630
    Fax: +01 408-867-2115
    E-Mail: 250-1752@mcimail.com.

Please let us know if there is an on-line source for this document.

CVS ID OF THIS PAGE:
$Id: smartctl.8,v 1.44 2003/01/14 20:04:05 ballen4705 Exp $