man sg_logs (Administration système) - read SCSI device log pages

NAME

sg_logs - read SCSI device log pages

SYNOPSIS

sg_logs [-a] [-c=<page_control>] [-h] [-H] [-l] [-p=<page_code>] [-paramp=<parameter_pointer>] [-pcb] [-ppc] [-r] [-sp] [-t] [-v] [-V] [-?] <scsi_device>

DESCRIPTION

This utility sends a LOG SENSE SCSI command to the given device and then outputs the response. This is used in most cases to fetch log pages stored on the given device and known log pages are decoded and output in ASCII. In one case a LOG SELECT SCSI command is issued to reset parameters back to the device manufacturer's default values.

-a
outputs all the log pages supported by the device.
-c=page_control
accepts 0, 1, 2 or 3 as an argument. 0 for current threshold values, 1 for current cumulative values, 2 for default threshold values and 3 for default cumulative values. The default is 1 (i.e. current threshold values).
-h
suppresses decoding of known log sense pages and prints out the response in hex instead.
-H
same action as '-h'.
-l
lists the names of all logs sense pages supported by this device. See the list of common log page codes below.
-p=<page_code>
log page code to fetch. Should be a hexadecimal number between 0 and 3f inclusive.
-paramp=<parameter_pointer>
parameter pointer value (in hex) to place in command. Should be a number between 0 and ffff inclusive.
-pcb
show Parameter Control Byte settings (only relevant when log parameters being output in ASCII).
-ppc
sets the Parameter Pointer Control (PPC) bit. Default is 0 (i.e. cleared).
-r
use LOG SELECT SCSI command to reset all implemented parameter values to be the device defined (i.e. manufacturer's) default values. In most cases the default values are zeroes. This option seems to clear error counter log pages but leaves pages like self-test results, start-stop cycle counter and temperature log pages unaffected. This option may be required to clear log pages if a counter reaches its maximum value since the log page in which the counter is found will remain "stuck" until something is done.
-sp
sets the Saving Parameters (SP) bit. Default is 0 (i.e. cleared). When set this instructs the device to store the current log page parameters (as indicated by the DS and TSD parameter codes) in some non-volatile location. Hence the log parameters will be preserved across power cycles. This option is typically not needed, especially if the GLTSD flag is clear in the control mode page as this instructs the device to periodically save all saveable log parameters to non-volatile locations.
-t
outputs the temperature. First looks in the temperature log page and if that is not available tries the Informational Exceptions page which may also have the current temperature (especially in older disks).
-v
verbose: show SCSI command blocks prior to execution. '-vv' and '-vvv' are also accepted yielding greater verbosity.
-V
print out version string
-?
output usage message. Ignore all other parameters.

Various log pages hold information error rates, device temperature, start stop cycles since device produced and the results of the last 20 self tests. Self tests can be initiated by the sg_senddiag utility. The smartmontools package provides much of the information found with sg_logs in a form suitable for monitoring the health of SCSI disks and tape drives.

Here is a list of log pages that are decoded by this utility. [Drop the "0x" prefix when using them as an argument to the '-p=' option]:

0x0 Supported log pages

0x1 Buffer overrun/underrun

0x2 Write error counter

0x3 Read error counter

0x4 Read reverse error counter

0x5 Verify error counter

0x6 Non-medium error

0x7 Last n error events

0x8 Format status (sbc-2)

0xb Last n deferred errors or asynchronous events

0xc Sequential access device (ssc-2)

0xd Temperature

0xe Start-stop cycle counter

0x10 Self-test results

0x17 Non-volatile cache

0x18 Protocol specific port (SAS transport)

0x2f Informational exceptions

0x37 Seagate cache (vendor, disk)

0x3e Seagate factory (vendor, disk)

In the 2.4 series of Linux kernels the given device must be a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks and SCSI DVDs) can also be specified. For example "sg_logs -a /dev/sda" will work in the 2.6 series kernels.

AUTHOR

Written by Doug Gilbert

REPORTING BUGS

Report bugs to <dgilbert at interlog dot com>.

COPYRIGHT

Copyright © 2002-2005 Douglas Gilbert

This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

smartctl(smartmontools: see net), sg_senddiag(sg3_utils)