1SG_SAT_IDENTIFY(8)                 SG3_UTILS                SG_SAT_IDENTIFY(8)
2
3
4

NAME

6       sg_sat_identify  -  send  ATA  IDENTIFY  DEVICE command via SCSI to ATA
7       Translation (SAT) layer
8

SYNOPSIS

10       sg_sat_identify  [--ck_cond]  [--extend]  [--help]  [--hex]   [--ident]
11       [--len=CLEN]  [--packet]  [--raw]  [--readonly] [--verbose] [--version]
12       DEVICE
13

DESCRIPTION

15       This utility sends either an ATA IDENTIFY  DEVICE  command  or  an  ATA
16       IDENTIFY  PACKET DEVICE command to DEVICE and outputs the response. The
17       devices that respond to these commands are ATA disks and ATAPI  devices
18       respectively.   Rather  than send these commands directly to the device
19       they are sent via a SCSI transport which is assumed to contain  a  SCSI
20       to  ATA Translation (SAT) Layer (SATL). The SATL may be in an operating
21       system driver, in host bus adapter firmware or in some external  enclo‐
22       sure.
23
24       The SAT standard (SAT ANSI INCITS 431-2007, prior draft: sat-r09.pdf at
25       www.t10.org) defines two SCSI "ATA PASS-THROUGH" commands: one using  a
26       16  byte  "cdb" and the other with a 12 byte cdb. This utility defaults
27       to using the 16 byte cdb variant. SAT-4 revision 5 added  a  SCSI  "ATA
28       PASS-THROUGH(32)"  command.  SAT-2  and  SAT-3  are now also standards:
29       SAT-2 ANSI INCITS 465-2010 and SAT-3 ANSI INCITS 517-2015 .  The  SAT-4
30       project   is   near  standardization  and  the  most  recent  draft  is
31       sat4r06.pdf .
32

OPTIONS

34       Arguments to long options are mandatory for short options as well.
35
36       -c, --ck_cond
37              sets the CK_COND bit in  the  ATA  PASS-THROUGH  SCSI  cdb.  The
38              default  setting  is  clear  (i.e.  0). When set the SATL should
39              yield a sense buffer containing a ATA  Result  descriptor  irre‐
40              spective  of whether the command succeeded or failed. When clear
41              the SATL should only yield  a  sense  buffer  containing  a  ATA
42              Result descriptor if the command failed.
43
44       -e, --extend
45              sets  the  EXTEND  bit  in  the  ATA  PASS-THROUGH SCSI cdb. The
46              default setting is clear (i.e. 0). When set a 48 bit LBA command
47              is sent to the device. This option has no effect when --len=12.
48
49       -h, --help
50              outputs  the usage message summarizing command line options then
51              exits. Ignores DEVICE if given.
52
53       -H, --hex
54              outputs the ATA IDENTIFY (PACKET) DEVICE response  in  hex.  The
55              default  action (i.e. without any '-H' options) is to output the
56              response in hex, grouped in 16 bit words  (i.e.  the  ATA  stan‐
57              dard's  preference).  When given once, the response is output in
58              ASCII hex bytes (i.e.  the  SCSI  standard's  preference).  When
59              given twice (i.e. '-HH') the output is in hex, grouped in 16 bit
60              words, the same as the default but without a header. When  given
61              thrice  (i.e.  '-HHH')  the  output is in hex, grouped in 16 bit
62              words, in a format that is acceptable for 'hdparm  --Istdin'  to
63              process. '-HHHH' simply outputs hex data bytes, space separated,
64              16 per line.
65
66       -i, --ident
67              outputs the World Wide Name (WWN) of the device. This should  be
68              a  NAA-5  64 bit number. It is output in hex prefixed with "0x".
69              If not available then "0x0000000000000000" is output. The equiv‐
70              alent  for a SCSI disk (i.e. its logical unit name) can be found
71              with "sg_vpd -ii".
72
73       -l, --len=CLEN
74              CLEN this is the length  of  the  SCSI  cdb  used  for  the  ATA
75              PASS-THROUGH  command.   CLEN  can  either  be 12, 16 or 32. The
76              default is 16. The larger cdb sizes are needed for  48  bit  LBA
77              addressing  of  ATA devices. The ATA Auxiliary and ICC registers
78              are only conveyed with the 32 byte cdb variant.
79
80       -p, --packet
81              send an ATA IDENTIFY PACKET DEVICE command (via the  SATL).  The
82              default  action  is to send an ATA IDENTIFY DEVICE command. Note
83              that the ATAPI specification by T13 (i.e. the PACKET  interface)
84              is now obsolete.
85
86       -r, --raw
87              output  the ATA IDENTIFY (PACKET) DEVICE response in binary. The
88              output should be piped to a file or another  utility  when  this
89              option  is  used.   The binary is sent to stdout, and errors are
90              sent to stderr.
91
92       -R, --readonly
93              open the DEVICE read-only (e.g. in Unix with the O_RDONLY flag).
94              The default is to open it read-write.
95
96       -v, --verbose
97              increases the level or verbosity.
98
99       -V, --version
100              print out version string
101

NOTES

103       Since  the  response  to  the  IDENTIFY (PACKET) DEVICE command is very
104       important for the correct use of an ATA(PI) device  (and  is  typically
105       the  first  command sent), a SATL should provide an ATA Information VPD
106       page which contains the similar information.
107
108       The SCSI ATA PASS-THROUGH (12) command's opcode is 0xa1 and it  clashes
109       with  the  MMC set's BLANK command used by cd/dvd writers. So a SATL in
110       front of an ATAPI device that uses MMC (i.e. has peripheral device type
111       5)  probably  should  treat  opcode 0xa1 as a BLANK command and send it
112       through to the cd/dvd drive. The ATA PASS-THROUGH (16) command's opcode
113       (0x85) does not clash with anything so it is a better choice.
114
115       Prior  to Linux kernel 2.6.29 USB mass storage limited sense data to 18
116       bytes  which  made  the  --ck_cond  option  yield  strange  (truncated)
117       results.
118

EXAMPLES

120       These  examples  use  Linux  device  names  and  a Linux utility called
121       hdparm. For suitable device names in other supported Operating  Systems
122       see the sg3_utils(8) man page.
123
124       In  this example /dev/sdb is a SATA 2.5" disk connected via a USB (type
125       C connector) dongle that implements the UAS (USB attached SCSI)  proto‐
126       col  (also  known as UASP). UAS is a vast improvement over the USB mass
127       storage class.
128
129           # sg_sat_identify /dev/sdb
130       Response for IDENTIFY DEVICE ATA command:
131        00   0c5a 3fff c837 0010 0000 0000 003f 0000  .Z ?. .7 .. .. .. .? ..
132        ....
133
134       The hexadecimal ASCII  (with  plain  ASCII  to  the  right)  output  is
135       abridged  to  a single line (i.e. the first 16 bytes (or 8 words)). Now
136       to decode some of that ATA Identify response. First sg_inq can decode a
137       few strings:
138
139           # sg_sat_identify -HHHH /dev/sdb | sg_inq --ata -I -
140       ATA device: model, serial number and firmware revision:
141         ST9500420AS     5VJCE6R7 0002SDM1
142
143       For a lot more details, the hdparm utility is a good choice:
144
145           # sg_sat_identify -HHH /dev/sdb | hdparm --Istdin
146       ATA device, with non-removable media
147               Model Number:       ST9500420AS
148               Serial Number:      5VJCE6R7
149               Firmware Revision:  0002SDM1
150               Transport:          Serial
151       Standards:
152        ....
153
154       There  are  about  80  more  lines of details decoded by hdparm in this
155       case.  Notice the difference in the number of "H" options:  three  give
156       an unadorned hex output arranged in (little endian) words (i.e. 16 bits
157       each) while four "H" options give an  unadorned  hex  output  in  bytes
158       (i.e. 8 bits each).
159

EXIT STATUS

161       The  exit  status of sg_sat_identify is 0 when it is successful. Other‐
162       wise see the sg3_utils(8) man page.
163

AUTHOR

165       Written by Douglas Gilbert
166

REPORTING BUGS

168       Report bugs to <dgilbert at interlog dot com>.
169
171       Copyright © 2006-2020 Douglas Gilbert
172       This software is distributed under a FreeBSD license. There is NO  war‐
173       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
174       POSE.
175

SEE ALSO

177       sg_vpd(sg3_utils), sg_inq(sg3_utils), sdparm(sdparm), hdparm(hdparm)
178
179
180
181sg3_utils-1.45                   January 2020               SG_SAT_IDENTIFY(8)
Impressum