Re: usage of WIN_SMART

From: Edward Falk
Date: Mon Nov 29 2004 - 19:13:49 EST



I have seen SMART system's code containing WIN_SMART directive in ioctl
sprinkled through out the code? What does that mean? What is its proper
usage? Is there a proper documentation for it?

Thanks in advance for all replies

Hi Jagadeesh; I'm not entirely sure what your question is, so I'll see if I can provide a vague enough answer to cover it :)

Executive summary: The SMART data is used to obtain information about the state of the drive hardware, for the purpose of predicting or diagnosing failures. What little documentation there is exists in the ATA/ATAPI specification, but most of the data is vendor-specific and undocumented. The easiest way to access SMART data is by cat'ing the appropriate file in /proc/ide/hdX




Long answer:

Many (all?) modern disk drives provide what is known as "SMART" (Self-Monitoring, Analysis, and Reporting Technology) data. This includes information about the performance of the drive, including how many errors the drive has corrected, what the drive temperature has been, and so on. The WIN_SMART command has a number of sub-commands (specified through the features register), which are described in the ATA spec under "Command descriptions".

AFAIK, there are no ioctls directly corresponding to the SMART commands, but the SMART commands can be accessed via the HDIO_DRIVE_TASKFILE ioctl. (NOTE: do not attempt this without a copy of the ATA spec in front of you.)

An even easier way to obtain the SMART data is to cat /proc/ide/hdX/smart_values or /proc/ide/hdX/smart_thresholds.

(At Google, we've added "smart_logs" and "smart_status" entries to /proc. We'll be submitting those patches Real Soon Now.)

The interesting SMART subcommands are:

SMART READ DATA

Read and return the 512-byte SMART data structure.
The ATA spec describes this structure, but most of the
interesting fields are vendor-specific. Several of the
vendors have adopted a number of common data fields,
such as spinup time, reallocation count, seek error
rate, and so on. In general though, the information is
really private to the vendor, intended for the vendor
to diagnose the drive.

SMART READ LOG

Returns one of a number of available logs, including log
directory, summary error log, comprehensive error log,
and so on, including a few vendor-specific logs.

SMART WRITE LOG

Write data to a log.

SMART RETURN STATUS

Returns a simple yes/no status indicating whether or
not any of the device's thresholds have been exceeded.



I hope this helps answer your questions.

-ed falk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/