SG_SAT_READ_GPLOG(8) | SG3_UTILS | SG_SAT_READ_GPLOG(8) |
sg_sat_read_gplog - use ATA READ LOG EXT or SMART READ LOG command via a SCSI to ATA Translation (SAT) layer
sg_sat_read_gplog [--address=LA_L] [--ck_cond] [--count=CO] [--dma] [--help] [--hex] [--len=CMD_LEN] [--log=LA_L] [--page=PN] [--ppt=PPT] [--readonly] [--smart] [--verbose] [--version] DEVICE
This utility sends an ATA READ LOG EXT, an ATA READ LOG DMA EXT, or an ATA SMART READ LOG command to the DEVICE. The default is to send one of the first two commands to read "general purpose log" page(s). Only (S)ATA devices (e.g. disks) but not ATAPI devices (e.g. DVD readers) support the general purpose log pages. Rather than send the READ LOG (DMA) EXT command directly to the device it is sent via a SCSI transport which is assumed to contain a SCSI to ATA Translation (SAT) Layer (SATL). The SATL may be in an operating system driver, in host bus adapter (HBA) firmware or in some external enclosure.
This utility does not currently attempt to decode the response from the ATA disk, rather it outputs the response in ASCII hexadecimal grouped in 8 bit bytes or 16 bit words. Following ATA conventions those words are decoded little endian (note that SCSI commands use a big endian representation). Log address 0, page number 0 is the 'directory' log page and it is decoded if no --hex option is given. In the future this utility may attempt to decode other log pages. Perhaps other ATA utility will be able to decode these log pages given hex output from this utility.
Fetching all log pages seems as simple as reading the directory log page then accessing those log addresses that have more than zero associated page numbers. Unfortunately it is not that simple. Some log addresses (looking specifically at 0xe1 ("SCT Data transfer")) need a SCT command executed prior to fetching the log page at that log address. Other log addresses might be problematic (e.g. it has been suggested that the "Device vendor specific logs" 0xa0:0xdf) so maybe they also should be avoided. That is the reason the --address=LA_L and --log=LA_L options are designed to take a list of ranges.
The SAT-4 standard (SAT ANSI INCITS 491-201r7 prior draft: sat4r06.pdf at www.t10.org) defines three SCSI "ATA PASS-THROUGH" commands: one using a 12 byte "cdb", another using a 16 bytes cdb, and the third a 32 byte cdb. This utility defaults to using the 16 byte cdb variant.
Arguments to long options are mandatory for short options as well.
If this option is invoked four times (e.g. '-HHHH') log pages are output as hex bytes, with no leading address at the start of each line. That makes the hex easier for computers to decode (but not humans). If this option is invoked five times then a comment line, starting with a '#' character is output before each 512 byte log page. The comment describes the following log page.
When multiple log addresses are specified (via the LA_L argument) then this option is treated differently. With multiple log addresses and if PN is greater than 0 then it acts as an upper limit of the number of page numbers that will be output for each log address. The actual number of 512 byte log pages output will also depend on the number of page numbers shown in the directory log page for the current log address.
Prior to Linux kernel 2.6.29 USB mass storage limited sense data to 18 bytes which made the --ck_cond option yield strange (truncated) results.
There are slight differences in handling when a single log address is being fetched, and when multiple log pages are being fetched. In the single log address case the log address, the page number and the count going into the corresponding fields in the ATA READ LOG EXT or ATA SMART READ LOG command. When multiple log addresses are given, the 'directory' log page (log_address=0, page_number=0) is first loaded. Then only log addresses which the directory indicates have more than zero log page numbers, are fetched. The count of log page numbers accessed may be further restricted by the --page=PN option if PN is greater than zero.
First here is an example avoiding the problematic log addresses noted in the DESCRIPTION section above.
sg_sat_read_gplog -a 0:0xb,0xd:0x9f,0xe0,0xe2:255 /dev/sdc
The above is using the short form of the --address=LA_L
option with a list that avoids log addresses 0xc, 0xa0 to 0xdf and 0xe1 .
The output will include all log addresses, apart from those exclusions, that
the directory indicates have more than 0 page numbers.
The following invocation uses the SMART READ LOG command instead of the READ
LOG EXT command:
sg_sat_read_gplog --smart -a 0:0xb,0xd:0x9f,0xe0,0xe2:255 /dev/sdc
The exit status of sg_sat_read_gplog is 0 when it is successful. Otherwise see the sg3_utils(8) man page.
Written by Hannes Reinecke and Douglas Gilbert
Report bugs to <dgilbert at interlog dot com>.
Copyright © 2014-2023 Hannes Reinecke, SUSE Linux GmbH
This software is distributed under a BSD-2-Clause license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
sg_sat_identify(sg3_utils), sg_inq(sg3_utils), sdparm(sdparm), hdparm(hdparm), smartctl(smartmontools)
January 2023 | sg3_utils-1.48 |