xref: /aosp_15_r20/external/sg3_utils/sg3_utils.man8.html (revision 44704f698541f6367e81f991ef8bb54ccbf3fc18)
1*44704f69SBart Van AsscheContent-type: text/html; charset=UTF-8
2*44704f69SBart Van Assche
3*44704f69SBart Van Assche<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4*44704f69SBart Van Assche<HTML><HEAD><TITLE>Man page of SG3_UTILS</TITLE>
5*44704f69SBart Van Assche</HEAD><BODY>
6*44704f69SBart Van Assche<H1>SG3_UTILS</H1>
7*44704f69SBart Van AsscheSection: SG3_UTILS (8)<BR>Updated: November 2021<BR><A HREF="#index">Index</A>
8*44704f69SBart Van Assche<A HREF="../index.html">Return to Main Contents</A><HR>
9*44704f69SBart Van Assche
10*44704f69SBart Van Assche<A NAME="lbAB">&nbsp;</A>
11*44704f69SBart Van Assche<H2>NAME</H2>
12*44704f69SBart Van Assche
13*44704f69SBart Van Asschesg3_utils - a package of utilities for sending SCSI commands
14*44704f69SBart Van Assche<A NAME="lbAC">&nbsp;</A>
15*44704f69SBart Van Assche<H2>SYNOPSIS</H2>
16*44704f69SBart Van Assche
17*44704f69SBart Van Assche<B>sg_*</B>
18*44704f69SBart Van Assche
19*44704f69SBart Van Assche[<I>--dry-run</I>] [<I>--enumerate</I>] [<I>--help</I>] [<I>--hex</I>]
20*44704f69SBart Van Assche[<I>--in=FN</I>] [<I>--inhex=FN</I>] [<I>--maxlen=LEN</I>] [<I>--raw</I>]
21*44704f69SBart Van Assche[<I>--timeout=SECS</I>] [<I>--verbose</I>] [<I>--version</I>]
22*44704f69SBart Van Assche[<I>OTHER_OPTIONS</I>] <I>DEVICE</I>
23*44704f69SBart Van Assche<A NAME="lbAD">&nbsp;</A>
24*44704f69SBart Van Assche<H2>DESCRIPTION</H2>
25*44704f69SBart Van Assche
26*44704f69SBart Van Assche
27*44704f69SBart Van Assche<P>
28*44704f69SBart Van Assche
29*44704f69SBart Van Asschesg3_utils is a package of utilities that send SCSI commands to the given
30*44704f69SBart Van Assche<I>DEVICE</I> via a SCSI pass through interface provided by the host
31*44704f69SBart Van Asscheoperating system.
32*44704f69SBart Van Assche<P>
33*44704f69SBart Van Assche
34*44704f69SBart Van AsscheThe names of all utilities start with &quot;sg&quot; and most start with &quot;sg_&quot; often
35*44704f69SBart Van Asschefollowed by the name, or a shortening of the name, of the SCSI command that
36*44704f69SBart Van Asschethey send. For example the &quot;sg_verify&quot; utility sends the SCSI VERIFY
37*44704f69SBart Van Asschecommand. A mapping between SCSI commands and the sg3_utils utilities that
38*44704f69SBart Van Asscheissue them is shown in the COVERAGE file. The sg_raw utility can be used to
39*44704f69SBart Van Asschesend an arbitrary SCSI command (supplied on the command line) to the
40*44704f69SBart Van Asschegiven <I>DEVICE</I>.
41*44704f69SBart Van Assche<P>
42*44704f69SBart Van Assche
43*44704f69SBart Van Asschesg_decode_sense can be used to decode SCSI sense data given on the command
44*44704f69SBart Van Asscheline or in a file. sg_raw -vvv will output the T10 name of a given SCSI
45*44704f69SBart Van AsscheCDB which is most often 16 bytes or less in length.
46*44704f69SBart Van Assche<P>
47*44704f69SBart Van Assche
48*44704f69SBart Van AsscheSCSI draft standards can be found at <A HREF="https://www.t10.org">https://www.t10.org</A> . The standards
49*44704f69SBart Van Asschethemselves can be purchased from ANSI and other standards organizations.
50*44704f69SBart Van AsscheA good overview of various SCSI standards can be seen in
51*44704f69SBart Van Assche<A HREF="https://www.t10.org/scsi-3.htm">https://www.t10.org/scsi-3.htm</A> with the SCSI command sets in the upper part
52*44704f69SBart Van Asscheof the diagram. The highest level (i.e. most abstract) document is the SCSI
53*44704f69SBart Van AsscheArchitecture Model (SAM) with SAM-5 being the most recent standard (ANSI
54*44704f69SBart Van AsscheINCITS 515-2016) with the most recent draft being SAM-6 revision 4 . SCSI
55*44704f69SBart Van Asschecommands in common with all device types can be found in SCSI Primary
56*44704f69SBart Van AsscheCommands (SPC) of which SPC-4 is the most recent standard (ANSI INCITS
57*44704f69SBart Van Assche513-2015). The most recent SPC draft is SPC-5 revision 21. Block device
58*44704f69SBart Van Asschespecific commands (e.g. as used by disks) are in SBC, those for tape drives
59*44704f69SBart Van Asschein SSC, those for SCSI enclosures in SES and those for CD/DVD/BD drives in
60*44704f69SBart Van AsscheMMC.
61*44704f69SBart Van Assche<P>
62*44704f69SBart Van Assche
63*44704f69SBart Van AsscheIt is becoming more common to control ATA disks with the SCSI command set.
64*44704f69SBart Van AsscheThis involves the translation of SCSI commands to their corresponding ATA
65*44704f69SBart Van Asscheequivalents (and that is an imperfect mapping in some cases). The relevant
66*44704f69SBart Van Asschestandard is called SCSI to ATA Translation (SAT, SAT-2 and SAT-3) are
67*44704f69SBart Van Asschenow standards at INCITS(ANSI) and ISO while SAT-4 is at the draft stage.
68*44704f69SBart Van AsscheThe logic to perform the command translation is often called a SAT Layer or
69*44704f69SBart Van AsscheSATL and may be within an operating system, in host bus adapter firmware or
70*44704f69SBart Van Asschein an external device (e.g. associated with a SAS expander). See
71*44704f69SBart Van Assche<A HREF="https://www.t10.org">https://www.t10.org</A> for more information.
72*44704f69SBart Van Assche<P>
73*44704f69SBart Van Assche
74*44704f69SBart Van AsscheThere is some support for SCSI tape devices but not for their basic
75*44704f69SBart Van Asscheoperation. The reader is referred to the &quot;mt&quot; utility.
76*44704f69SBart Van Assche<P>
77*44704f69SBart Van Assche
78*44704f69SBart Van AsscheThere are two generations of command line option usage. The newer
79*44704f69SBart Van Asscheutilities (written since July 2004) use the getopt_long() function to parse
80*44704f69SBart Van Asschecommand line options. With that function, each option has two representations:
81*44704f69SBart Van Asschea short form (e.g. '-v') and a longer form (e.g. '--verbose'). If an
82*44704f69SBart Van Asscheargument is required then it follows a space (optionally) in the short form
83*44704f69SBart Van Asscheand a &quot;=&quot; in the longer form (e.g. in the sg_verify utility '-l 2a6h'
84*44704f69SBart Van Asscheand '--lba=2a6h' are equivalent). Note that with getopt_long(), short form
85*44704f69SBart Van Asscheoptions can be elided, for example: '-all' is equivalent to '-a -l -l'.
86*44704f69SBart Van AsscheThe <I>DEVICE</I> argument may appear after, between or prior to any options.
87*44704f69SBart Van Assche<P>
88*44704f69SBart Van Assche
89*44704f69SBart Van AsscheThe older utilities, including as sg_inq, sg_logs, sg_modes, sg_opcode,
90*44704f69SBart Van Asschesg_rbuff,  sg_readcap, sg_senddiag, sg_start and sg_turs had individual
91*44704f69SBart Van Asschecommand line processing code typically based on a single &quot;-&quot; followed by one
92*44704f69SBart Van Asscheor more characters. If an argument is needed then it follows a &quot;=&quot; (
93*44704f69SBart Van Asschee.g. '-p=1f' in sg_modes with its older interface). Various options can be
94*44704f69SBart Van Asscheelided as long as it is not ambiguous (e.g. '-vv' to increase the verbosity).
95*44704f69SBart Van Assche<P>
96*44704f69SBart Van Assche
97*44704f69SBart Van AsscheOver time the command line interface of these older utilities became messy
98*44704f69SBart Van Asscheand overloaded with options. So in sg3_utils version 1.23 the command line
99*44704f69SBart Van Asscheinterface of these older utilities was altered to have both a cleaner
100*44704f69SBart Van Asschegetopt_long() interface and their older interface for backward compatibility.
101*44704f69SBart Van AsscheBy default these older utilities use their getopt_long() based interface.
102*44704f69SBart Van AsscheThe getopt_long() is a GNU extension (i.e. not yet POSIX certified) but
103*44704f69SBart Van Asschemore recent command line utilities tend to use it. That can be overridden
104*44704f69SBart Van Asscheby defining the SG3_UTILS_OLD_OPTS environment variable or using '-O'
105*44704f69SBart Van Asscheor '--old' as the first command line option. The man pages of the older
106*44704f69SBart Van Asscheutilities documents the details.
107*44704f69SBart Van Assche<P>
108*44704f69SBart Van Assche
109*44704f69SBart Van AsscheSeveral sg3_utils utilities are based on the Unix dd command (e.g. sg_dd)
110*44704f69SBart Van Asscheand permit copying data at the level of SCSI READ and WRITE commands. sg_dd
111*44704f69SBart Van Asscheis tightly bound to Linux and hence is not ported to other OSes. A more
112*44704f69SBart Van Asschegeneric utility (than sg_dd) called ddpt in a package of the same name has
113*44704f69SBart Van Asschebeen ported to other OSes.
114*44704f69SBart Van Assche<A NAME="lbAE">&nbsp;</A>
115*44704f69SBart Van Assche<H2>ENVIRONMENT VARIABLES</H2>
116*44704f69SBart Van Assche
117*44704f69SBart Van AsscheThe SG3_UTILS_OLD_OPTS environment variable is explained in the previous
118*44704f69SBart Van Asschesection. It is only for backward compatibility of the command line options
119*44704f69SBart Van Asschefor older utilities.
120*44704f69SBart Van Assche<P>
121*44704f69SBart Van Assche
122*44704f69SBart Van AsscheThe SG3_UTILS_DSENSE environment variable may be set to a number. It is
123*44704f69SBart Van Asscheonly used by the embedded SNTL within the library used by the utilities in
124*44704f69SBart Van Asschethis library. SNTL is a SCSI to NVMe Translation Layer. This environment
125*44704f69SBart Van Asschevariable defaults to 0 which will lead to any utility that issues a SCSI
126*44704f69SBart Van Asschecommand that is translated to a NVMe command (by the embedded SNTL) that
127*44704f69SBart Van Asschefails at the NVMe dvice, to return SCSI sense in 'fixed' format. If this
128*44704f69SBart Van Asschevariable is non-zero then then the returned SCSI sense will be in 'descriptor'
129*44704f69SBart Van Asscheformat.
130*44704f69SBart Van Assche<P>
131*44704f69SBart Van Assche
132*44704f69SBart Van AsscheSeveral utilities have their own environment variable setting (e.g.
133*44704f69SBart Van Asschesg_persist has SG_PERSIST_IN_RDONLY). See individual utility man pages
134*44704f69SBart Van Asschefor more information.
135*44704f69SBart Van Assche<P>
136*44704f69SBart Van Assche
137*44704f69SBart Van AsscheThere is a Linux specific environment variable called SG3_UTILS_LINUX_NANO
138*44704f69SBart Van Asschethat if defined and the sg driver in the system is 4.0.30 or later, will
139*44704f69SBart Van Asscheshow command durations in nanoseconds rather than the default milliseconds.
140*44704f69SBart Van AsscheCommand durations are typically only shown if --verbose is used 3 or more
141*44704f69SBart Van Asschetimes. Due to an interface problem (a 32 bit integer that should be 64 bits
142*44704f69SBart Van Asschewith the benefit of hindsight) the maximum duration that can be represented
143*44704f69SBart Van Asschein nanoseconds is about 4.2 seconds. If longer durations may occur then
144*44704f69SBart Van Asschedon't define this environment variable (or undefine it).
145*44704f69SBart Van Assche<A NAME="lbAF">&nbsp;</A>
146*44704f69SBart Van Assche<H2>LINUX DEVICE NAMING</H2>
147*44704f69SBart Van Assche
148*44704f69SBart Van AsscheMost disk block devices have names like /dev/sda, /dev/sdb, /dev/sdc, etc.
149*44704f69SBart Van AsscheSCSI disks in Linux have always had names like that but in recent Linux
150*44704f69SBart Van Asschekernels it has become more common for many other disks (including SATA
151*44704f69SBart Van Asschedisks and USB storage devices) to be named like that. Partitions within a
152*44704f69SBart Van Asschedisk are specified by a number appended to the device name, starting at
153*44704f69SBart Van Assche1 (e.g. /dev/sda1 ).
154*44704f69SBart Van Assche<P>
155*44704f69SBart Van Assche
156*44704f69SBart Van AsscheTape drives are named /dev/st&lt;num&gt; or /dev/nst&lt;num&gt; where &lt;num&gt; starts
157*44704f69SBart Van Asscheat zero. Additionally one letter from this list: &quot;lma&quot; may be appended to
158*44704f69SBart Van Asschethe name. CD, DVD and BD readers (and writers) are named /dev/sr&lt;num&gt;
159*44704f69SBart Van Asschewhere &lt;num&gt; start at zero. There are less used SCSI device type names,
160*44704f69SBart Van Asschethe dmesg and the lsscsi commands may help to find if any are attached to
161*44704f69SBart Van Asschea running system.
162*44704f69SBart Van Assche<P>
163*44704f69SBart Van Assche
164*44704f69SBart Van AsscheThere is also a SCSI device driver which offers alternate generic access
165*44704f69SBart Van Asscheto SCSI devices. It uses names of the form /dev/sg&lt;num&gt; where &lt;num&gt; starts
166*44704f69SBart Van Asscheat zero. The &quot;lsscsi -g&quot; command may be useful in finding these and which
167*44704f69SBart Van Asschegeneric name corresponds to a device type name (e.g. /dev/sg2 may
168*44704f69SBart Van Asschecorrespond to /dev/sda). In the lk 2.6 series a block SCSI generic
169*44704f69SBart Van Asschedriver was introduced and its names are of the form
170*44704f69SBart Van Assche/dev/bsg/&lt;h:c:t:l&gt; where h, c, t and l are numbers. Again see the lsscsi
171*44704f69SBart Van Asschecommand to find the correspondence between that SCSI tuple (i.e. &lt;h:c:t:l&gt;)
172*44704f69SBart Van Asscheand alternate device names.
173*44704f69SBart Van Assche<P>
174*44704f69SBart Van Assche
175*44704f69SBart Van AsschePrior to the Linux kernel 2.6 series these utilities could only use
176*44704f69SBart Van Asschegeneric device names (e.g. /dev/sg1 ). In almost all cases in the Linux
177*44704f69SBart Van Asschekernel 2.6 series, any device name can be used by these utilities.
178*44704f69SBart Van Assche<P>
179*44704f69SBart Van Assche
180*44704f69SBart Van AsscheVery little has changed in Linux device naming in the Linux kernel 3
181*44704f69SBart Van Asscheand 4 series.
182*44704f69SBart Van Assche<A NAME="lbAG">&nbsp;</A>
183*44704f69SBart Van Assche<H2>WINDOWS DEVICE NAMING</H2>
184*44704f69SBart Van Assche
185*44704f69SBart Van AsscheStorage and related devices can have several device names in Windows.
186*44704f69SBart Van AsscheProbably the most common in the volume name (e.g. &quot;D:&quot;). There are also
187*44704f69SBart Van Asschea &quot;class&quot; device names such as &quot;PhysicalDrive&lt;n&gt;&quot;, &quot;CDROM&lt;n&gt;&quot;
188*44704f69SBart Van Asscheand &quot;TAPE&lt;n&gt;&quot;. &lt;n&gt; is an integer starting at 0 allocated in ascending
189*44704f69SBart Van Asscheorder as devices are discovered (and sometimes rediscovered).
190*44704f69SBart Van Assche<P>
191*44704f69SBart Van Assche
192*44704f69SBart Van AsscheSome storage devices have a SCSI lower level device name which starts
193*44704f69SBart Van Asschewith a SCSI (pseudo) adapter name of the form &quot;SCSI&lt;n&gt;:&quot;. To this is added
194*44704f69SBart Van Asschesub-addressing in the form of a &quot;bus&quot; number, a &quot;target&quot; identifier and
195*44704f69SBart Van Asschea LUN (Logical Unit Number). The &quot;bus&quot; number is also known as a &quot;PathId&quot;.
196*44704f69SBart Van AsscheThese are assembled to form a device name of the
197*44704f69SBart Van Asscheform: &quot;SCSI&lt;n&gt;:&lt;bus&gt;,&lt;target&gt;,&lt;lun&gt;&quot;. The trailing &quot;,&lt;lun&gt;&quot; may be omitted
198*44704f69SBart Van Asschein which case a LUN of zero is assumed. This lower level device name cannot
199*44704f69SBart Van Asscheoften be used directly since Windows blocks attempts to use it if a class
200*44704f69SBart Van Asschedriver has &quot;claimed&quot; the device. There are SCSI device types (e.g.
201*44704f69SBart Van AsscheAutomation/Drive interface type) for which there is no class driver. At
202*44704f69SBart Van Asscheleast two transports (&quot;bus types&quot; in Windows jargon): USB and IEEE 1394 do
203*44704f69SBart Van Asschenot have a &quot;scsi&quot; device names of this form.
204*44704f69SBart Van Assche<P>
205*44704f69SBart Van Assche
206*44704f69SBart Van AsscheIn keeping with DOS file system conventions, the various device names
207*44704f69SBart Van Asschecan be given in upper, lower or mixed case. Since &quot;PhysicalDrive&lt;n&gt;&quot; is
208*44704f69SBart Van Asschetedious to write, a shortened form of &quot;PD&lt;n&gt;&quot; is permitted by all
209*44704f69SBart Van Asscheutilities in this package.
210*44704f69SBart Van Assche<P>
211*44704f69SBart Van Assche
212*44704f69SBart Van AsscheA single device (e.g. a disk) can have many device names. For
213*44704f69SBart Van Asscheexample: &quot;PD0&quot; can also be &quot;C:&quot;, &quot;D:&quot; and &quot;SCSI0:0,1,0&quot;. The two volume names
214*44704f69SBart Van Asschereflect that the disk has two partitions on it. Disk partitions that are
215*44704f69SBart Van Asschenot recognized by Windows are not usually given a volume name. However
216*44704f69SBart Van AsscheVista does show a volume name for a disk which has no partitions recognized
217*44704f69SBart Van Asscheby it and when selected invites the user to format it (which may be rather
218*44704f69SBart Van Asscheunfriendly to other OSes).
219*44704f69SBart Van Assche<P>
220*44704f69SBart Van Assche
221*44704f69SBart Van AsscheThese utilities assume a given device name is in the Win32 device namespace.
222*44704f69SBart Van AsscheTo make that explicit &quot;\\.\&quot; can be prepended to the device names mentioned
223*44704f69SBart Van Asschein this section. Beware that backslash is an escape character in Unix like
224*44704f69SBart Van Asscheshells and the C programming language. In a shell like Msys (from MinGW)
225*44704f69SBart Van Asscheeach backslash may need to be typed twice.
226*44704f69SBart Van Assche<P>
227*44704f69SBart Van Assche
228*44704f69SBart Van AsscheThe sg_scan utility within this package lists out Windows device names in
229*44704f69SBart Van Asschea form that is suitable for other utilities in this package to use.
230*44704f69SBart Van Assche<A NAME="lbAH">&nbsp;</A>
231*44704f69SBart Van Assche<H2>FREEBSD DEVICE NAMING</H2>
232*44704f69SBart Van Assche
233*44704f69SBart Van AsscheSCSI disks have block names of the form /dev/da&lt;num&gt; where &lt;num&gt; is an
234*44704f69SBart Van Asscheinteger starting at zero. The &quot;da&quot; is replaced by &quot;sa&quot; for SCSI tape
235*44704f69SBart Van Asschedrives and &quot;cd&quot; for SCSI CD/DVD/BD drives. Each SCSI device has a
236*44704f69SBart Van Asschecorresponding pass-through device name of the form /dev/pass&lt;num&gt;
237*44704f69SBart Van Asschewhere &lt;num&gt; is an integer starting at zero. The &quot;camcontrol devlist&quot;
238*44704f69SBart Van Asschecommand may be useful for finding out which SCSI device names are
239*44704f69SBart Van Asscheavailable and the correspondence between class and pass-through names.
240*44704f69SBart Van Assche<P>
241*44704f69SBart Van Assche
242*44704f69SBart Van AsscheFreeBSD allows device names to be given without the leading &quot;/dev/&quot; (e.g.
243*44704f69SBart Van Asscheda0 instead of /dev/da0). That worked in this package up until version
244*44704f69SBart Van Assche1.43 when the unadorned device name (e.g. &quot;da0&quot;) gave an error. The
245*44704f69SBart Van Asscheoriginal action (i.e. allowing unadorned device names) has been restored
246*44704f69SBart Van Asschein version 1.46 . Also note that symlinks (to device names) are followed
247*44704f69SBart Van Asschebefore prepending &quot;/dev/&quot; if the resultant name doesn't start with a &quot;/&quot;.
248*44704f69SBart Van Assche<P>
249*44704f69SBart Van Assche
250*44704f69SBart Van AsscheFreeBSD's NVMe naming has been evolving. The controller naming is the
251*44704f69SBart Van Asschesame as Linux: &quot;/dev/nvme&lt;n&gt;&quot; but the namespaces have an
252*44704f69SBart Van Asscheextra &quot;s&quot; (e.g. &quot;/dev/nvme0ns1&quot;). The latter is not a block (GEOM)
253*44704f69SBart Van Asschedevice (strictly speaking FreeBSD does not have block devices). Initially
254*44704f69SBart Van AsscheFreeBSD had &quot;/dev/nvd&lt;m&gt;&quot; GEOM devices that were not based on the CAM
255*44704f69SBart Van Asschesubsystem. Then in FreeBSD release 12 a new nda driver was added that is
256*44704f69SBart Van AsscheCAM (and GEOM) based for NVMe namespaces; it has names like &quot;/dev/nda0&quot;.
257*44704f69SBart Van AsscheThe preferred device nodes for this package are &quot;/dev/nvme0&quot; for NVMe
258*44704f69SBart Van Asschecontrollers and &quot;/dev/nda0&quot; for NVMe namespaces.
259*44704f69SBart Van Assche<A NAME="lbAI">&nbsp;</A>
260*44704f69SBart Van Assche<H2>SOLARIS DEVICE NAMING</H2>
261*44704f69SBart Van Assche
262*44704f69SBart Van AsscheSCSI device names below the /dev directory have a form like: c5t4d3s2
263*44704f69SBart Van Asschewhere the number following &quot;c&quot; is the controller (HBA) number, the number
264*44704f69SBart Van Asschefollowing &quot;t&quot; is the target number (from the SCSI parallel interface days)
265*44704f69SBart Van Asscheand the number following &quot;d&quot; is the LUN. Following the &quot;s&quot; is the slice
266*44704f69SBart Van Asschenumber which is related to a partition and by convention &quot;s2&quot; is the whole
267*44704f69SBart Van Asschedisk.
268*44704f69SBart Van Assche<P>
269*44704f69SBart Van Assche
270*44704f69SBart Van AsscheOpenSolaris also has a c5t4d3p2 form where the number following the &quot;p&quot; is
271*44704f69SBart Van Asschethe partition number apart from &quot;p0&quot; which is the whole disk. So a whole
272*44704f69SBart Van Asschedisk may be referred to as either c5t4d3, c5t4d3s2 or c5t4d3p0 .
273*44704f69SBart Van Assche<P>
274*44704f69SBart Van Assche
275*44704f69SBart Van AsscheAnd these device names are duplicated in the /dev/dsk and /dev/rdsk
276*44704f69SBart Van Asschedirectories. The former is the block device name and the latter is
277*44704f69SBart Van Asschefor &quot;raw&quot; (or char device) access which is what sg3_utils needs. So in
278*44704f69SBart Van AsscheOpenSolaris something of the form 'sg_inq /dev/rdsk/c5t4d3p0' should work.
279*44704f69SBart Van AsscheIf it doesn't work then add a '-vvv' option for more debug information.
280*44704f69SBart Van AsscheTrying this form 'sg_inq /dev/dsk/c5t4d3p0' (note &quot;rdsk&quot; changed to &quot;dsk&quot;)
281*44704f69SBart Van Asschewill result in an &quot;inappropriate ioctl for device&quot; error.
282*44704f69SBart Van Assche<P>
283*44704f69SBart Van Assche
284*44704f69SBart Van AsscheThe device names within the /dev directory are typically symbolic links to
285*44704f69SBart Van Asschemuch longer topological names in the /device directory. In Solaris cd/dvd/bd
286*44704f69SBart Van Asschedrives seem to be treated as disks and so are found in the /dev/rdsk
287*44704f69SBart Van Asschedirectory. Tape drives appear in the /dev/rmt directory.
288*44704f69SBart Van Assche<P>
289*44704f69SBart Van Assche
290*44704f69SBart Van AsscheThere is also a sgen (SCSI generic) driver which by default does not attach
291*44704f69SBart Van Asscheto any device. See the /kernel/drv/sgen.conf file to control what is
292*44704f69SBart Van Asscheattached. Any attached device will have a device name of the
293*44704f69SBart Van Asscheform /dev/scsi/c5t4d3 .
294*44704f69SBart Van Assche<P>
295*44704f69SBart Van Assche
296*44704f69SBart Van AsscheListing available SCSI devices in Solaris seems to be a challenge. &quot;Use
297*44704f69SBart Van Asschethe 'format' command&quot; advice works but seems a very dangerous way to list
298*44704f69SBart Van Asschedevices. [It does prompt again before doing any damage.] 'devfsadm -Cv'
299*44704f69SBart Van Asschecleans out the clutter in the /dev/rdsk directory, only leaving what
300*44704f69SBart Van Asscheis &quot;live&quot;. The &quot;cfgadm -v&quot; command looks promising.
301*44704f69SBart Van Assche<A NAME="lbAJ">&nbsp;</A>
302*44704f69SBart Van Assche<H2>NVME SUPPORT</H2>
303*44704f69SBart Van Assche
304*44704f69SBart Van AsscheNVMe (or NVM Express) is a relatively new storage transport and command
305*44704f69SBart Van Asscheset. The level of abstraction of the NVMe command set is somewhat lower
306*44704f69SBart Van Asschethe SCSI command sets, closer to the level of abstraction of ATA (and SATA)
307*44704f69SBart Van Asschecommand sets. NVMe claims to be designed with flash and modern &quot;solid
308*44704f69SBart Van Asschestate&quot; storage in mind, something unheard of when SCSI was originally
309*44704f69SBart Van Asschedeveloped in the 1980s.
310*44704f69SBart Van Assche<P>
311*44704f69SBart Van Assche
312*44704f69SBart Van AsscheThe SCSI command sets' advantage is the length of time they have been in
313*44704f69SBart Van Asscheplace and the existing tools (like these) to support it. Plus SCSI command
314*44704f69SBart Van Asschesets level of abstraction is both and advantage and disadvantage. Recently
315*44704f69SBart Van Asschethe NVME-MI (Management Interface) designers decide to use the SCSI
316*44704f69SBart Van AsscheEnclosure Services (SES-3) standard &quot;as is&quot; with the addition of two
317*44704f69SBart Van Asschetunnelling NVME-MI commands: SES Send and SES Receive. This means after the
318*44704f69SBart Van AsscheOS interface differences are taken into account, the sg_ses, sg_ses_microcode
319*44704f69SBart Van Asscheand sg_senddiag utilities can be used on a NVMe device that supports a newer
320*44704f69SBart Van Asscheversion of NVME-MI.
321*44704f69SBart Van Assche<P>
322*44704f69SBart Van Assche
323*44704f69SBart Van AsscheThe NVME-MI SES Send and SES Receive commands correspond to the SCSI
324*44704f69SBart Van AsscheSEND DIAGNOSTIC and RECEIVE DIAGNOSTIC RESULTS commands respectively.
325*44704f69SBart Van AsscheThere are however a few other commands that need to be translated, the
326*44704f69SBart Van Asschemost important of which is the SCSI INQUIRY command to the NVMe Identify
327*44704f69SBart Van Asschecontroller/namespace. Starting in version 1.43 these utilities contain a
328*44704f69SBart Van Asschesmall SNTL (SCSI to NVMe Translation Layer) to take care of these details.
329*44704f69SBart Van Assche<P>
330*44704f69SBart Van Assche
331*44704f69SBart Van AsscheAs a side effect of this &quot;juggling&quot; if the sg_inq utility is used (without
332*44704f69SBart Van Asschethe --page= option) on a NVMe <I>DEVICE</I> then the actual NVMe
333*44704f69SBart Van AsscheIdentifier (controller and possibly namespace) responses are decoded and
334*44704f69SBart Van Asscheoutput. However if 'sg_inq --page=sinq &lt;device&gt;' is given for the
335*44704f69SBart Van Asschesame <I>DEVICE</I> then parts of the NVMe Identify controller and namespace
336*44704f69SBart Van Asscheresponse are translated to a SCSI standard INQUIRY response which is then
337*44704f69SBart Van Asschedecoded and output.
338*44704f69SBart Van Assche<P>
339*44704f69SBart Van Assche
340*44704f69SBart Van AsscheApart from the special case with the sg_inq, all other utilities in the
341*44704f69SBart Van Asschepackage assume they are talking to a SCSI device and decode any response
342*44704f69SBart Van Asscheaccordingly. One easy way for users to see the underlying device is a
343*44704f69SBart Van AsscheNVMe device is the standard INQUIRY response Vendor Identification field
344*44704f69SBart Van Asscheof &quot;NVMe    &quot; (an 8 character long string with 4 spaces to the right).
345*44704f69SBart Van Assche<P>
346*44704f69SBart Van Assche
347*44704f69SBart Van AsscheThe following SCSI commands are currently supported by the SNTL library:
348*44704f69SBart Van AsscheINQUIRY, MODE SELECT(10), MODE SENSE(10), READ(10,16), READ CAPACITY(10,16),
349*44704f69SBart Van AsscheRECEIVE DIAGNOSTIC RESULTS, REQUEST SENSE, REPORT LUNS, REPORT SUPPORTED
350*44704f69SBart Van AsscheOPERATION CODES, REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS, SEND
351*44704f69SBart Van AsscheDIAGNOSTICS, START STOP UNIT, SYNCHRONIZE CACHE(10,16), TEST UNIT READY,
352*44704f69SBart Van AsscheVERIFY(10,16), WRITE(10,16) and WRITE SAME(10,16).
353*44704f69SBart Van Assche<A NAME="lbAK">&nbsp;</A>
354*44704f69SBart Van Assche<H2>EXIT STATUS</H2>
355*44704f69SBart Van Assche
356*44704f69SBart Van AsscheTo aid scripts that call these utilities, the exit status is set to indicate
357*44704f69SBart Van Asschesuccess (0) or failure (1 or more). Note that some of the lower values
358*44704f69SBart Van Asschecorrespond to the SCSI sense key values.
359*44704f69SBart Van Assche<P>
360*44704f69SBart Van Assche
361*44704f69SBart Van AsscheThe exit status values listed below can be given to the sg_decode_sense
362*44704f69SBart Van Asscheutility (which is found in this package) as follows:
363*44704f69SBart Van Assche<BR>
364*44704f69SBart Van Assche
365*44704f69SBart Van Assche<BR>&nbsp;&nbsp;sg_decode_sense&nbsp;--err=&lt;exit_status&gt;
366*44704f69SBart Van Assche<BR>
367*44704f69SBart Van Assche
368*44704f69SBart Van Asscheand a short explanatory string will be output to stdout.
369*44704f69SBart Van Assche<P>
370*44704f69SBart Van Assche
371*44704f69SBart Van AsscheThe exit status values are:
372*44704f69SBart Van Assche<DL COMPACT>
373*44704f69SBart Van Assche<DT><B>0</B>
374*44704f69SBart Van Assche
375*44704f69SBart Van Assche<DD>
376*44704f69SBart Van Asschesuccess. Also used for some utilities that wish to return a boolean value
377*44704f69SBart Van Asschefor the &quot;true&quot; case (and that no error has occurred). The false case is
378*44704f69SBart Van Asscheconveyed by exit status 36.
379*44704f69SBart Van Assche<DT><B>1</B>
380*44704f69SBart Van Assche
381*44704f69SBart Van Assche<DD>
382*44704f69SBart Van Asschesyntax error. Either illegal command line options, options with bad
383*44704f69SBart Van Asschearguments or a combination of options that is not permitted.
384*44704f69SBart Van Assche<DT><B>2</B>
385*44704f69SBart Van Assche
386*44704f69SBart Van Assche<DD>
387*44704f69SBart Van Asschethe <I>DEVICE</I> reports that it is not ready for the operation requested.
388*44704f69SBart Van AsscheThe <I>DEVICE</I> may be in the process of becoming ready (e.g.  spinning up
389*44704f69SBart Van Asschebut not at speed) so the utility may work after a wait. In Linux the
390*44704f69SBart Van Assche<I>DEVICE</I> may be temporarily blocked while error recovery is taking place.
391*44704f69SBart Van Assche<DT><B>3</B>
392*44704f69SBart Van Assche
393*44704f69SBart Van Assche<DD>
394*44704f69SBart Van Asschethe <I>DEVICE</I> reports a medium or hardware error (or a blank check). For
395*44704f69SBart Van Asscheexample an attempt to read a corrupted block on a disk will yield this value.
396*44704f69SBart Van Assche<DT><B>5</B>
397*44704f69SBart Van Assche
398*44704f69SBart Van Assche<DD>
399*44704f69SBart Van Asschethe <I>DEVICE</I> reports an &quot;illegal request&quot; with an additional sense code
400*44704f69SBart Van Asscheother than &quot;invalid command operation code&quot;. This is often a supported
401*44704f69SBart Van Asschecommand with a field set requesting an unsupported capability. For commands
402*44704f69SBart Van Asschethat require a &quot;service action&quot; field this value can indicate that the
403*44704f69SBart Van Asschecommand with that service action value is not supported.
404*44704f69SBart Van Assche<DT><B>6</B>
405*44704f69SBart Van Assche
406*44704f69SBart Van Assche<DD>
407*44704f69SBart Van Asschethe <I>DEVICE</I> reports a &quot;unit attention&quot; condition. This usually indicates
408*44704f69SBart Van Asschethat something unrelated to the requested command has occurred (e.g. a device
409*44704f69SBart Van Asschereset) potentially before the current SCSI command was sent. The requested
410*44704f69SBart Van Asschecommand has not been executed by the device. Note that unit attention
411*44704f69SBart Van Asscheconditions are usually only reported once by a device.
412*44704f69SBart Van Assche<DT><B>7</B>
413*44704f69SBart Van Assche
414*44704f69SBart Van Assche<DD>
415*44704f69SBart Van Asschethe <I>DEVICE</I> reports a &quot;data protect&quot; sense key. This implies some
416*44704f69SBart Van Asschemechanism has blocked writes (or possibly all access to the media).
417*44704f69SBart Van Assche<DT><B>9</B>
418*44704f69SBart Van Assche
419*44704f69SBart Van Assche<DD>
420*44704f69SBart Van Asschethe <I>DEVICE</I> reports an illegal request with an additional sense code
421*44704f69SBart Van Asscheof &quot;invalid command operation code&quot; which means that it doesn't support the
422*44704f69SBart Van Asscherequested command.
423*44704f69SBart Van Assche<DT><B>10</B>
424*44704f69SBart Van Assche
425*44704f69SBart Van Assche<DD>
426*44704f69SBart Van Asschethe <I>DEVICE</I> reports a &quot;copy aborted&quot;. This implies another command or
427*44704f69SBart Van Asschedevice problem has stopped a copy operation. The EXTENDED COPY family of
428*44704f69SBart Van Asschecommands (including WRITE USING TOKEN) may return this sense key.
429*44704f69SBart Van Assche<DT><B>11</B>
430*44704f69SBart Van Assche
431*44704f69SBart Van Assche<DD>
432*44704f69SBart Van Asschethe <I>DEVICE</I> reports an aborted command. In some cases aborted
433*44704f69SBart Van Asschecommands can be retried immediately (e.g. if the transport aborted
434*44704f69SBart Van Asschethe command due to congestion).
435*44704f69SBart Van Assche<DT><B>14</B>
436*44704f69SBart Van Assche
437*44704f69SBart Van Assche<DD>
438*44704f69SBart Van Asschethe <I>DEVICE</I> reports a miscompare sense key. VERIFY and COMPARE AND
439*44704f69SBart Van AsscheWRITE commands may report this.
440*44704f69SBart Van Assche<DT><B>15</B>
441*44704f69SBart Van Assche
442*44704f69SBart Van Assche<DD>
443*44704f69SBart Van Asschethe utility is unable to open, close or use the given <I>DEVICE</I> or some
444*44704f69SBart Van Asscheother file. The given file name could be incorrect or there may be
445*44704f69SBart Van Asschepermission problems. Adding the '-v' option may give more information.
446*44704f69SBart Van Assche<DT><B>17</B>
447*44704f69SBart Van Assche
448*44704f69SBart Van Assche<DD>
449*44704f69SBart Van Asschea SCSI &quot;Illegal request&quot; sense code received with a flag indicating the
450*44704f69SBart Van AsscheInfo field is valid. This is often a LBA but its meaning is command specific.
451*44704f69SBart Van Assche<DT><B>18</B>
452*44704f69SBart Van Assche
453*44704f69SBart Van Assche<DD>
454*44704f69SBart Van Asschethe <I>DEVICE</I> reports a medium or hardware error (or a blank check)
455*44704f69SBart Van Asschewith a flag indicating the Info field is valid. This is often a LBA (of
456*44704f69SBart Van Asschethe first encountered error) but its meaning is command specific.
457*44704f69SBart Van Assche<DT><B>20</B>
458*44704f69SBart Van Assche
459*44704f69SBart Van Assche<DD>
460*44704f69SBart Van Asschethe <I>DEVICE</I> reports it has a check condition but &quot;no sense&quot;
461*44704f69SBart Van Asscheand non-zero information in its additional sense codes. Some polling
462*44704f69SBart Van Asschecommands (e.g. REQUEST SENSE) can receive this response. There may
463*44704f69SBart Van Asschebe useful information in the sense data such as a progress indication.
464*44704f69SBart Van Assche<DT><B>21</B>
465*44704f69SBart Van Assche
466*44704f69SBart Van Assche<DD>
467*44704f69SBart Van Asschethe <I>DEVICE</I> reports a &quot;recovered error&quot;. The requested command
468*44704f69SBart Van Asschewas successful. Most likely a utility will report a recovered error
469*44704f69SBart Van Asscheto stderr and continue, probably leaving the utility with an exit
470*44704f69SBart Van Asschestatus of 0 .
471*44704f69SBart Van Assche<DT><B>22</B>
472*44704f69SBart Van Assche
473*44704f69SBart Van Assche<DD>
474*44704f69SBart Van Asschethe <I>DEVICE</I> reports that the current command or its parameters imply
475*44704f69SBart Van Asschea logical block address (LBA) that is out of range. This happens surprisingly
476*44704f69SBart Van Asscheoften when trying to access the last block on a storage device; either a
477*44704f69SBart Van Asscheclassic &quot;off by one&quot; logic error or a misreading of the response from READ
478*44704f69SBart Van AsscheCAPACITY(10 or 16) in which the address of the last block rather than the
479*44704f69SBart Van Asschenumber of blocks on the <I>DEVICE</I> is returned. Since LBAs are origin zero
480*44704f69SBart Van Asschethey range from 0 to n-1 where n is the number of blocks on the <I>DEVICE</I>,
481*44704f69SBart Van Asscheso the LBA of the last block is one less than the total number of blocks.
482*44704f69SBart Van Assche<DT><B>24</B>
483*44704f69SBart Van Assche
484*44704f69SBart Van Assche<DD>
485*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;reservation conflict&quot;. This
486*44704f69SBart Van Asschemeans access to the <I>DEVICE</I> with the current command has been blocked
487*44704f69SBart Van Asschebecause another machine (HBA or SCSI &quot;initiator&quot;) holds a reservation on
488*44704f69SBart Van Asschethis <I>DEVICE</I>. On modern SCSI systems this is related to the use of
489*44704f69SBart Van Asschethe PERSISTENT RESERVATION family of commands.
490*44704f69SBart Van Assche<DT><B>25</B>
491*44704f69SBart Van Assche
492*44704f69SBart Van Assche<DD>
493*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;condition met&quot;. Currently only
494*44704f69SBart Van Asschethe PRE-FETCH command (see SBC-4) yields this status.
495*44704f69SBart Van Assche<DT><B>26</B>
496*44704f69SBart Van Assche
497*44704f69SBart Van Assche<DD>
498*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;busy&quot;. SAM-6 defines this status
499*44704f69SBart Van Asscheas the logical unit is temporarily unable to process a command. It is
500*44704f69SBart Van Asscherecommended to re-issue the command.
501*44704f69SBart Van Assche<DT><B>27</B>
502*44704f69SBart Van Assche
503*44704f69SBart Van Assche<DD>
504*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;task set full&quot;.
505*44704f69SBart Van Assche<DT><B>28</B>
506*44704f69SBart Van Assche
507*44704f69SBart Van Assche<DD>
508*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;ACA active&quot;. ACA is &quot;auto
509*44704f69SBart Van Asschecontingent allegiance&quot; and is seldom used.
510*44704f69SBart Van Assche<DT><B>29</B>
511*44704f69SBart Van Assche
512*44704f69SBart Van Assche<DD>
513*44704f69SBart Van Asschethe <I>DEVICE</I> reports a SCSI status of &quot;task aborted&quot;. SAM-5 says:
514*44704f69SBart Van Assche&quot;This status shall be returned if a command is aborted by a command or task
515*44704f69SBart Van Asschemanagement function on another I_T nexus and the Control mode page TAS bit
516*44704f69SBart Van Asscheis set to one&quot;.
517*44704f69SBart Van Assche<DT><B>31</B>
518*44704f69SBart Van Assche
519*44704f69SBart Van Assche<DD>
520*44704f69SBart Van Asscheerror involving two or more command line options. They may be contradicting,
521*44704f69SBart Van Asscheselect an unsupported mode, or a required option (given the context) is
522*44704f69SBart Van Asschemissing.
523*44704f69SBart Van Assche<DT><B>32</B>
524*44704f69SBart Van Assche
525*44704f69SBart Van Assche<DD>
526*44704f69SBart Van Asschethere is a logic error in the utility. It corresponds to code comments
527*44704f69SBart Van Asschelike &quot;shouldn't/can't get here&quot;. Perhaps the author should be informed.
528*44704f69SBart Van Assche<DT><B>33</B>
529*44704f69SBart Van Assche
530*44704f69SBart Van Assche<DD>
531*44704f69SBart Van Asschethe command sent to <I>DEVICE</I> has timed out.
532*44704f69SBart Van Assche<DT><B>34</B>
533*44704f69SBart Van Assche
534*44704f69SBart Van Assche<DD>
535*44704f69SBart Van Asschethis is a Windows only exit status and indicates that the Windows error
536*44704f69SBart Van Asschenumber (32 bits) cannot meaningfully be mapped to an equivalent Unix error
537*44704f69SBart Van Asschenumber returned as the exit status (7 bits).
538*44704f69SBart Van Assche<DT><B>35</B>
539*44704f69SBart Van Assche
540*44704f69SBart Van Assche<DD>
541*44704f69SBart Van Asschea transport error has occurred. This will either be in the driver (e.g. HBA
542*44704f69SBart Van Asschedriver) or in the interconnect between the host (initiator) and the
543*44704f69SBart Van Asschedevice (target).  For example in SAS an expander can run out of paths and
544*44704f69SBart Van Asschethus be unable to return the user data for a READ command.
545*44704f69SBart Van Assche<DT><B>36</B>
546*44704f69SBart Van Assche
547*44704f69SBart Van Assche<DD>
548*44704f69SBart Van Asscheno error has occurred plus the utility wants to convey a boolean value
549*44704f69SBart Van Asscheof false. The corresponding true value is conveyed by a 0 exit status.
550*44704f69SBart Van Assche<DT><B>40</B>
551*44704f69SBart Van Assche
552*44704f69SBart Van Assche<DD>
553*44704f69SBart Van Asschethe command sent to <I>DEVICE</I> has received an &quot;aborted command&quot; sense
554*44704f69SBart Van Asschekey with an additional sense code of 0x10. This value is related to
555*44704f69SBart Van Asscheproblems with protection information (PI or DIF). For example this error
556*44704f69SBart Van Asschemay occur when reading a block on a drive that has never been written (or
557*44704f69SBart Van Asscheis unmapped) if that drive was formatted with type 1, 2 or 3 protection.
558*44704f69SBart Van Assche<DT><B>41</B>
559*44704f69SBart Van Assche
560*44704f69SBart Van Assche<DD>
561*44704f69SBart Van Asschethe command sent to <I>DEVICE</I> has received an &quot;aborted command&quot; sense
562*44704f69SBart Van Asschekey with an additional sense code of 0x10 (as with error code) plus a flag
563*44704f69SBart Van Asscheindicating the Info field is valid.
564*44704f69SBart Van Assche<DT><B>48</B>
565*44704f69SBart Van Assche
566*44704f69SBart Van Assche<DD>
567*44704f69SBart Van Asschethis is an internal message indicating a NVMe status field (SF) is other
568*44704f69SBart Van Asschethan zero after a command has been executed (i.e. something went wrong).
569*44704f69SBart Van AsscheWork in this area is currently experimental.
570*44704f69SBart Van Assche<DT><B>49</B>
571*44704f69SBart Van Assche
572*44704f69SBart Van Assche<DD>
573*44704f69SBart Van Asschelow level driver reports a response's residual count (i.e. number of bytes
574*44704f69SBart Van Asscheactually received by HBA is 'requested_bytes - residual_count') that is
575*44704f69SBart Van Asschenonsensical.
576*44704f69SBart Van Assche<DT><B>50</B>
577*44704f69SBart Van Assche
578*44704f69SBart Van Assche<DD>
579*44704f69SBart Van AsscheOS system calls that fail often return a small integer number to help. In
580*44704f69SBart Van AsscheUnix these are called &quot;errno&quot; values where 0 implies no error. These error
581*44704f69SBart Van Asschecodes set aside 51 to 96 for mapping these errno values but that may not be
582*44704f69SBart Van Asschesufficient. Higher errno values that cannot be mapped are all mapped to
583*44704f69SBart Van Asschethis value (i.e. 50).
584*44704f69SBart Van Assche<BR>
585*44704f69SBart Van Assche
586*44704f69SBart Van AsscheNote that an errno value of 0 is mapped to error code 0.
587*44704f69SBart Van Assche<DT><B>50 + &lt;os_error_number&gt;</B>
588*44704f69SBart Van Assche
589*44704f69SBart Van Assche<DD>
590*44704f69SBart Van AsscheOS system calls that fail often return a small integer number to help
591*44704f69SBart Van Asscheindicate what the error is. For example in Unix the inability of a system
592*44704f69SBart Van Asschecall to allocate memory returns (in 'errno') ENOMEM which often is
593*44704f69SBart Van Asscheassociated with the integer 12. So 62 (i.e. '50 + 12') may be returned
594*44704f69SBart Van Asscheby a utility in this case. It is also possible that a utility in this
595*44704f69SBart Van Asschepackage reports 50+ENOMEM when it can't allocate memory, not necessarily
596*44704f69SBart Van Asschefrom an OS system call. In recent versions of Linux the file showing the
597*44704f69SBart Van Asschemapping between symbolic constants (e.g. ENOMEM) and the corresponding
598*44704f69SBart Van Asscheinteger is in the kernel source code file:
599*44704f69SBart Van Asscheinclude/uapi/asm-generic/errno-base.h
600*44704f69SBart Van Assche<BR>
601*44704f69SBart Van Assche
602*44704f69SBart Van AsscheNote that errno values that are greater than or equal to 47 cannot fit in
603*44704f69SBart Van Asscherange provided. Instead they are all mapped to 50 as discussed in the
604*44704f69SBart Van Asscheprevious entry.
605*44704f69SBart Van Assche<DT><B>97</B>
606*44704f69SBart Van Assche
607*44704f69SBart Van Assche<DD>
608*44704f69SBart Van Asschea SCSI command response failed sanity checks.
609*44704f69SBart Van Assche<DT><B>98</B>
610*44704f69SBart Van Assche
611*44704f69SBart Van Assche<DD>
612*44704f69SBart Van Asschethe <I>DEVICE</I> reports it has a check condition but the error
613*44704f69SBart Van Asschedoesn't fit into any of the above categories.
614*44704f69SBart Van Assche<DT><B>99</B>
615*44704f69SBart Van Assche
616*44704f69SBart Van Assche<DD>
617*44704f69SBart Van Asscheany errors that can't be categorized into values 1 to 98 may yield
618*44704f69SBart Van Asschethis value. This includes transport and operating system errors
619*44704f69SBart Van Asscheafter the command has been sent to the device.
620*44704f69SBart Van Assche<DT><B>100-125</B>
621*44704f69SBart Van Assche
622*44704f69SBart Van Assche<DD>
623*44704f69SBart Van Asschethese error codes are used by the ddpt utility which uses the sg3_utils
624*44704f69SBart Van Asschelibrary. They are mainly specialized error codes associated with offloaded
625*44704f69SBart Van Asschecopies.
626*44704f69SBart Van Assche<DT><B>126</B>
627*44704f69SBart Van Assche
628*44704f69SBart Van Assche<DD>
629*44704f69SBart Van Asschethe utility was found but could not be executed. That might occur if the
630*44704f69SBart Van Asscheexecutable does not have execute permissions.
631*44704f69SBart Van Assche<DT><B>127</B>
632*44704f69SBart Van Assche
633*44704f69SBart Van Assche<DD>
634*44704f69SBart Van AsscheThis is the exit status for utility not found. That might occur when a
635*44704f69SBart Van Asschescript calls a utility in this package but the PATH environment variable
636*44704f69SBart Van Asschehas not been properly set up, so the script cannot find the executable.
637*44704f69SBart Van Assche<DT><B>128 + &lt;signum&gt;</B>
638*44704f69SBart Van Assche
639*44704f69SBart Van Assche<DD>
640*44704f69SBart Van AsscheIf a signal kills a utility then the exit status is 128 plus the signal
641*44704f69SBart Van Asschenumber. For example if a segmentation fault occurs then a utility is
642*44704f69SBart Van Asschetypically killed by SIGSEGV which according to 'man 7 signal' has an
643*44704f69SBart Van Asscheassociated signal number of 11; so the exit status will be 139 .
644*44704f69SBart Van Assche<DT><B>255</B>
645*44704f69SBart Van Assche
646*44704f69SBart Van Assche<DD>
647*44704f69SBart Van Asschethe utility tried to yield an exit status of 255 or larger. That should
648*44704f69SBart Van Asschenot happen; given here for completeness.
649*44704f69SBart Van Assche</DL>
650*44704f69SBart Van Assche<P>
651*44704f69SBart Van Assche
652*44704f69SBart Van AsscheMost of the error conditions reported above will be repeatable (an example
653*44704f69SBart Van Asscheof one that is not is &quot;unit attention&quot;) so the utility can be run again with
654*44704f69SBart Van Asschethe '-v' option (or several) to obtain more information.
655*44704f69SBart Van Assche<A NAME="lbAL">&nbsp;</A>
656*44704f69SBart Van Assche<H2>COMMON OPTIONS</H2>
657*44704f69SBart Van Assche
658*44704f69SBart Van AsscheArguments to long options are mandatory for short options as well. In the
659*44704f69SBart Van Asscheshort form an argument to an option uses zero or more spaces as a
660*44704f69SBart Van Asscheseparator (i.e. the short form does not use &quot;=&quot; as a separator).
661*44704f69SBart Van Assche<P>
662*44704f69SBart Van Assche
663*44704f69SBart Van AsscheIf an option takes a numeric argument then that argument is assumed to
664*44704f69SBart Van Asschebe decimal unless otherwise indicated (e.g. with a leading &quot;0x&quot;, a
665*44704f69SBart Van Asschetrailing &quot;h&quot; or as noted in the usage message).
666*44704f69SBart Van Assche<P>
667*44704f69SBart Van Assche
668*44704f69SBart Van AsscheSome options are used uniformly in most of the utilities in this
669*44704f69SBart Van Asschepackage. Those options are listed below. Note that there are some
670*44704f69SBart Van Asscheexceptions.
671*44704f69SBart Van Assche<DL COMPACT>
672*44704f69SBart Van Assche<DT><B>-d</B>, <B>--dry-run</B><DD>
673*44704f69SBart Van Asscheutilities that can cause lots of user data to be lost or overwritten
674*44704f69SBart Van Asschesometimes have a <I>--dry-run</I> option. Device modifying actions are
675*44704f69SBart Van Asschetypically bypassed (or skipped) to implement a policy of &quot;do no harm&quot;.
676*44704f69SBart Van AsscheThis allows complex command line invocations to be tested before the
677*44704f69SBart Van Asscheaction required (e.g. format a disk) is performed. The <I>--dry-run</I>
678*44704f69SBart Van Asscheoption has become a common feature of many command line utilities (e.g.
679*44704f69SBart Van Asschethe Unix 'patch' command), not just those from this package.
680*44704f69SBart Van Assche<BR>
681*44704f69SBart Van Assche
682*44704f69SBart Van AsscheNote that most hyphenated option names in this package also can be given
683*44704f69SBart Van Asschewith an underscore rather than a hyphen (e.g.  <I>--dry_run</I>).
684*44704f69SBart Van Assche<DT><B>-e</B>, <B>--enumerate</B><DD>
685*44704f69SBart Van Asschesome utilities (e.g. sg_ses and sg_vpd) store a lot of information in
686*44704f69SBart Van Asscheinternal tables. This option will output that information in some readable
687*44704f69SBart Van Asscheform (e.g. sorted by an acronym or by page number) then exit. Note that
688*44704f69SBart Van Asschewith this option <I>DEVICE</I> is ignored (as are most other options) and no
689*44704f69SBart Van AsscheSCSI IO takes place, so the invoker does not need any elevated permissions.
690*44704f69SBart Van Assche<DT><B>-h</B>, <B>-?</B>, <B>--help</B><DD>
691*44704f69SBart Van Asscheoutput the usage message then exit. In a few older utilities the '-h'
692*44704f69SBart Van Asscheoption requests hexadecimal output. In these cases the '-?' option will
693*44704f69SBart Van Asscheoutput the usage message then exit.
694*44704f69SBart Van Assche<DT><B>-H</B>, <B>--hex</B><DD>
695*44704f69SBart Van Asschefor SCSI commands that yield a non-trivial response, print out that
696*44704f69SBart Van Asscheresponse in ASCII hexadecimal. To produce hexadecimal that can be parsed
697*44704f69SBart Van Asscheby other utilities (e.g. without a relative address to the left and without
698*44704f69SBart Van Asschetrailing ASCII) use this option three or four times.
699*44704f69SBart Van Assche<DT><B>-i</B>, <B>--in</B>=<I>FN</I><DD>
700*44704f69SBart Van Asschemany SCSI commands fetch a significant amount of data (returned in the
701*44704f69SBart Van Asschedata-in buffer) which several of these utilities decode (e.g. sg_vpd and
702*44704f69SBart Van Asschesg_logs). To separate the two steps of fetching the data from a SCSI device
703*44704f69SBart Van Asscheand then decoding it, this option has been added. The first step (fetching
704*44704f69SBart Van Asschethe data) can be done using the <I>--hex</I> or <I>--raw</I> option and
705*44704f69SBart Van Asscheredirecting the command line output to a file (often done with &quot;&gt;&quot; in Unix
706*44704f69SBart Van Asschebased operating systems). The difference between <I>--hex</I> and
707*44704f69SBart Van Assche<I>--raw</I> is that the former produces output in ASCII hexadecimal
708*44704f69SBart Van Asschewhile <I>--raw</I> produces its output in &quot;raw&quot; binary.
709*44704f69SBart Van Assche<BR>
710*44704f69SBart Van Assche
711*44704f69SBart Van AsscheThe second step (i.e. decoding the SCSI response data now held in a file)
712*44704f69SBart Van Asschecan be done using this <I>--in=FN</I> option where the file name is
713*44704f69SBart Van Assche<I>FN</I>. If &quot;-&quot; is used for <I>FN</I> then stdin is assumed, again this
714*44704f69SBart Van Asscheallows for command line redirection (or piping). That file (or stdin)
715*44704f69SBart Van Asscheis assumed to contain ASCII hexadecimal unless the <I>--raw</I> option is
716*44704f69SBart Van Asschealso given in which case it is assumed to be binary. Notice that the meaning
717*44704f69SBart Van Asscheof the <I>--raw</I> option is &quot;flipped&quot; when used with <I>--in=FN</I> to
718*44704f69SBart Van Asscheact on the input, typically it acts on the output data.
719*44704f69SBart Van Assche<BR>
720*44704f69SBart Van Assche
721*44704f69SBart Van AsscheSince the structure of the data returned by SCSI commands varies
722*44704f69SBart Van Asscheconsiderably then the usage information or the manpage of the utility being
723*44704f69SBart Van Asscheused should be checked. In some cases <I>--hex</I> may need to be used
724*44704f69SBart Van Asschemultiple times (and is more conveniently given as '-HH' or '-HHH).
725*44704f69SBart Van Assche<DT><B>-i</B>, <B>--inhex</B>=<I>FN</I><DD>
726*44704f69SBart Van AsscheThis option has the same or similar functionality as <I>--in=FN</I>. And
727*44704f69SBart Van Asscheperhaps 'inhex' is more descriptive since by default, ASCII hexadecimal is
728*44704f69SBart Van Asscheexpected in the contents of file: <I>FN</I>. Alternatively the short form
729*44704f69SBart Van Asscheoption may be <I>-I</I> or <I>-X</I>. See the &quot;FORMAT OF FILES CONTAINING
730*44704f69SBart Van AsscheASCII HEX&quot; section below for more information.
731*44704f69SBart Van Assche<DT><B>-m</B>, <B>--maxlen</B>=<I>LEN</I><DD>
732*44704f69SBart Van Asscheseveral important SCSI commands (e.g. INQUIRY and MODE SENSE) have response
733*44704f69SBart Van Asschelengths that vary depending on many factors, only some of which these
734*44704f69SBart Van Asscheutilities take into account. The maximum response length is typically
735*44704f69SBart Van Asschespecified in the 'allocation length' field of the cdb. In the absence of
736*44704f69SBart Van Asschethis option, several utilities use a default allocation length (sometimes
737*44704f69SBart Van Asscherecommended in the SCSI draft standards) or a &quot;double fetch&quot; strategy.
738*44704f69SBart Van AsscheSee <A HREF="../man8/sg_logs.8.html">sg_logs</A>(8) for its description of a &quot;double fetch&quot; strategy. These
739*44704f69SBart Van Asschetechniques are imperfect and in the presence of faulty SCSI targets can
740*44704f69SBart Van Asschecause problems (e.g. some USB mass storage devices freeze if they receive
741*44704f69SBart Van Asschean INQUIRY allocation length other than 36). Also use of this option
742*44704f69SBart Van Asschedisables any &quot;double fetch&quot; strategy that may have otherwise been used.
743*44704f69SBart Van Assche<BR>
744*44704f69SBart Van Assche
745*44704f69SBart Van AsscheTo head off a class of degenerate bugs, if <I>LEN</I> is less than 16 then
746*44704f69SBart Van Asscheit is ignored (usually with a warning message) and the default value is
747*44704f69SBart Van Asscheused instead. Some utilities use 4 (bytes), rather than 16, as the cutoff
748*44704f69SBart Van Asschevalue.
749*44704f69SBart Van Assche<DT><B>-r</B>, <B>--raw</B><DD>
750*44704f69SBart Van Asschefor SCSI commands that yield a non-trivial response, output that response
751*44704f69SBart Van Asschein binary to stdout. If any error messages or warning are produced they are
752*44704f69SBart Van Asscheusually sent to stderr so as to not interfere with the output from this
753*44704f69SBart Van Asscheoption.
754*44704f69SBart Van Assche<BR>
755*44704f69SBart Van Assche
756*44704f69SBart Van AsscheSome utilities that consume data to send to the <I>DEVICE</I> along with the
757*44704f69SBart Van AsscheSCSI command, use this option. Alternatively the <I>--in=FN</I> option causes
758*44704f69SBart Van Assche<I>DEVICE</I> to be ignored and the response data (to be decoded) fetched
759*44704f69SBart Van Asschefrom a file named <I>FN</I>. In these cases this option may indicate that
760*44704f69SBart Van Asschebinary data can be read from stdin or from a nominated file (e.g. <I>FN</I>).
761*44704f69SBart Van Assche<DT><B>-t</B>, <B>--timeout</B>=<I>SECS</I><DD>
762*44704f69SBart Van Asscheutilities that issue potentially long-running SCSI commands often have a
763*44704f69SBart Van Assche<I>--timeout=SECS</I> option. This typically instructs the operating system
764*44704f69SBart Van Asscheto abort the SCSI command in question once the timeout expires. Aborting
765*44704f69SBart Van AsscheSCSI commands is typically a messy business and in the case of format like
766*44704f69SBart Van Asschecommands may leave the device in a &quot;format corrupt&quot; state requiring another
767*44704f69SBart Van Asschelong-running re-initialization command to be sent. The argument, <I>SECS</I>,
768*44704f69SBart Van Asscheis usually in seconds and the short form of the option may be something
769*44704f69SBart Van Asscheother than <I>-t</I> since the timeout option was typically added later as
770*44704f69SBart Van Asschestorage devices grew in size and initialization commands took longer. Since
771*44704f69SBart Van Asschemany utilities had relatively long internal command timeouts before this
772*44704f69SBart Van Asscheoption was introduced, the actual command timeout given to the operating
773*44704f69SBart Van Asschesystems is the higher of the internal timeout and <I>SECS</I>.
774*44704f69SBart Van Assche<BR>
775*44704f69SBart Van Assche
776*44704f69SBart Van AsscheMany long running SCSI commands have an IMMED bit which causes the command
777*44704f69SBart Van Asscheto finish relatively quickly but the initialization process to continue. In
778*44704f69SBart Van Asschesuch cases the REQUEST SENSE command can be used to monitor progress with
779*44704f69SBart Van Asscheits progress indication field (see the sg_requests and sg_turs utilities).
780*44704f69SBart Van AsscheUtilities that send such SCSI command either have an <I>--immed</I> option
781*44704f69SBart Van Asscheor a <I>--wait</I> option which is the logical inverse of the &quot;immediate&quot;
782*44704f69SBart Van Asscheaction.
783*44704f69SBart Van Assche<DT><B>-v</B>, <B>--verbose</B><DD>
784*44704f69SBart Van Asscheincrease the level of verbosity, (i.e. debug output). Can be used multiple
785*44704f69SBart Van Asschetimes to further increase verbosity. The additional output caused by this
786*44704f69SBart Van Asscheoption is almost always sent to stderr.
787*44704f69SBart Van Assche<DT><B>-V</B>, <B>--version</B><DD>
788*44704f69SBart Van Asscheprint the version string and then exit. Each utility has its own version
789*44704f69SBart Van Asschenumber and date of last code change.
790*44704f69SBart Van Assche</DL>
791*44704f69SBart Van Assche<A NAME="lbAM">&nbsp;</A>
792*44704f69SBart Van Assche<H2>NUMERIC ARGUMENTS</H2>
793*44704f69SBart Van Assche
794*44704f69SBart Van AsscheMany utilities have command line options that take numeric arguments. These
795*44704f69SBart Van Asschenumeric arguments can be large values (e.g. a logical block address (LBA) on
796*44704f69SBart Van Asschea disk) and can be inconvenient to enter in the default decimal
797*44704f69SBart Van Asscherepresentation. So various other representations are permitted.
798*44704f69SBart Van Assche<P>
799*44704f69SBart Van Assche
800*44704f69SBart Van AsscheMultiplicative suffixes are accepted. They are one, two or three letter
801*44704f69SBart Van Asschestrings appended directly after the number to which they apply:
802*44704f69SBart Van Assche<P>
803*44704f69SBart Van Assche
804*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;c&nbsp;C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*1
805*44704f69SBart Van Assche<BR>
806*44704f69SBart Van Assche
807*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;w&nbsp;W&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*2
808*44704f69SBart Van Assche<BR>
809*44704f69SBart Van Assche
810*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;b&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*512
811*44704f69SBart Van Assche<BR>
812*44704f69SBart Van Assche
813*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;k&nbsp;K&nbsp;KiB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*1024
814*44704f69SBart Van Assche<BR>
815*44704f69SBart Van Assche
816*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;KB&nbsp;kB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*1000
817*44704f69SBart Van Assche<BR>
818*44704f69SBart Van Assche
819*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;m&nbsp;M&nbsp;MiB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*1048576
820*44704f69SBart Van Assche<BR>
821*44704f69SBart Van Assche
822*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;MB&nbsp;mB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*1000000
823*44704f69SBart Van Assche<BR>
824*44704f69SBart Van Assche
825*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;g&nbsp;G&nbsp;GiB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(2^30)
826*44704f69SBart Van Assche<BR>
827*44704f69SBart Van Assche
828*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;GB&nbsp;gB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(10^9)
829*44704f69SBart Van Assche<BR>
830*44704f69SBart Van Assche
831*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;t&nbsp;T&nbsp;TiB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(2^40)
832*44704f69SBart Van Assche<BR>
833*44704f69SBart Van Assche
834*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;TB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(10^12)
835*44704f69SBart Van Assche<BR>
836*44704f69SBart Van Assche
837*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;p&nbsp;P&nbsp;PiB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(2^50)
838*44704f69SBart Van Assche<BR>
839*44704f69SBart Van Assche
840*44704f69SBart Van Assche<BR>&nbsp;&nbsp;&nbsp;PB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(10^15)
841*44704f69SBart Van Assche<P>
842*44704f69SBart Van Assche
843*44704f69SBart Van AsscheAn example is &quot;2k&quot; for 2048. The large tera and peta suffixes are only
844*44704f69SBart Van Asscheavailable for numeric arguments that might require 64 bits to represent
845*44704f69SBart Van Asscheinternally.
846*44704f69SBart Van Assche<P>
847*44704f69SBart Van Assche
848*44704f69SBart Van AsscheThese multiplicative suffixes are compatible with GNU's dd command (since
849*44704f69SBart Van Assche2002) which claims compliance with SI and with IEC 60027-2.
850*44704f69SBart Van Assche<P>
851*44704f69SBart Van Assche
852*44704f69SBart Van AsscheA suffix of the form &quot;x&lt;n&gt;&quot; multiplies the preceding number by &lt;n&gt;. An
853*44704f69SBart Van Asscheexample is &quot;2x33&quot; for &quot;66&quot;. The left argument cannot be '0' as '0x' will
854*44704f69SBart Van Asschebe interpreted as hexadecimal number prefix (see below). The left
855*44704f69SBart Van Asscheargument to the multiplication must end in a hexadecimal digit (i.e.
856*44704f69SBart Van Assche0 to f) and the whole expression cannot have any embedded whitespace (e.g.
857*44704f69SBart Van Asschespaces). An ugly example: &quot;0xfx0x2&quot; for 30.
858*44704f69SBart Van Assche<P>
859*44704f69SBart Van Assche
860*44704f69SBart Van AsscheA suffix of the form &quot;+&lt;n&gt;&quot; adds the preceding number to &lt;n&gt;. An example
861*44704f69SBart Van Asscheis &quot;3+1k&quot; for &quot;1027&quot;. The left argument to the addition must end in a
862*44704f69SBart Van Asschehexadecimal digit (i.e. 0 to f) and the whole expression cannot have any
863*44704f69SBart Van Asscheembedded whitespace (e.g. spaces). Another example: &quot;0xf+0x2&quot; for 17.
864*44704f69SBart Van Assche<P>
865*44704f69SBart Van Assche
866*44704f69SBart Van AsscheAlternatively numerical arguments can be given in hexadecimal. There are
867*44704f69SBart Van Asschetwo syntaxes. The number can be preceded by either &quot;0x&quot; or &quot;0X&quot; as found
868*44704f69SBart Van Asschein the C programming language. The second hexadecimal representation is a
869*44704f69SBart Van Asschetrailing &quot;h&quot; or &quot;H&quot; as found in (storage) standards. When hex numbers are
870*44704f69SBart Van Asschegiven, multipliers cannot be used. For example the decimal value &quot;256&quot; can
871*44704f69SBart Van Asschebe given as &quot;0x100&quot; or &quot;100h&quot;.
872*44704f69SBart Van Assche<A NAME="lbAN">&nbsp;</A>
873*44704f69SBart Van Assche<H2>FORMAT OF FILES CONTAINING ASCII HEX</H2>
874*44704f69SBart Van Assche
875*44704f69SBart Van AsscheSuch a file is assumed to contain a sequence of one or two digit ASCII
876*44704f69SBart Van Asschehexadecimal values separated by whitespace. &quot;Whitespace consists of either
877*44704f69SBart Van Asschespaces, tabs, blank lines, or any combination thereof&quot;. Each one or two digit
878*44704f69SBart Van AsscheASCII hex pair is decoded into a byte (i.e. 8 bits). The following will be
879*44704f69SBart Van Asschedecoded to valid (ascending valued)
880*44704f69SBart Van Asschebytes: '0', '01', '3', 'c', 'F', '4a', 'cC', 'ff'.
881*44704f69SBart Van AsscheLines containing only whitespace are ignored. The contents of any line
882*44704f69SBart Van Asschecontaining a hash mark ('#') is ignored from that point until the end of that
883*44704f69SBart Van Asscheline. Users are encouraged to use hash marks to introduce comments in hex
884*44704f69SBart Van Asschefiles. The author uses the extension'.hex' on such files. Examples can be
885*44704f69SBart Van Asschefound in the 'inhex' directory.
886*44704f69SBart Van Assche<A NAME="lbAO">&nbsp;</A>
887*44704f69SBart Van Assche<H2>MICROCODE AND FIRMWARE</H2>
888*44704f69SBart Van Assche
889*44704f69SBart Van AsscheThere are two standardized methods for downloading microcode (i.e. device
890*44704f69SBart Van Asschefirmware) to a SCSI device. The more general way is with the SCSI WRITE
891*44704f69SBart Van AsscheBUFFER command, see the sg_write_buffer utility. SCSI enclosures have
892*44704f69SBart Van Asschetheir own method based on the Download microcode control/status diagnostic
893*44704f69SBart Van Asschepage, see the sg_ses_microcode utility.
894*44704f69SBart Van Assche<A NAME="lbAP">&nbsp;</A>
895*44704f69SBart Van Assche<H2>SCRIPTS, EXAMPLES and UTILS</H2>
896*44704f69SBart Van Assche
897*44704f69SBart Van AsscheThere are several bash shell scripts in the 'scripts' subdirectory that
898*44704f69SBart Van Asscheinvoke compiled utilities (e.g. sg_readcap). Several of the scripts start
899*44704f69SBart Van Asschewith 'scsi_' rather than 'sg_'. One purpose of these scripts is to call the
900*44704f69SBart Van Asschesame utility (e.g. sg_readcap) on multiple devices. Most of the basic
901*44704f69SBart Van Asschecompiled utilities only allow one device as an argument. Some distributions
902*44704f69SBart Van Asscheinstall these scripts in a more visible directory (e.g. /usr/bin). Some of
903*44704f69SBart Van Asschethese scripts have man page entries. See the README file in the 'scripts'
904*44704f69SBart Van Asschesubdirectory.
905*44704f69SBart Van Assche<P>
906*44704f69SBart Van Assche
907*44704f69SBart Van AsscheThere is some example C code plus examples of complex invocations in
908*44704f69SBart Van Asschethe 'examples' subdirectory. There is also a README file. The example C
909*44704f69SBart Van Asschemay be a simpler example of how to use a SCSI pass-through in Linux
910*44704f69SBart Van Asschethan the main utilities (found in the 'src' subdirectory). This is due
911*44704f69SBart Van Asscheto the fewer abstraction layers (e.g. they don't worry the MinGW in
912*44704f69SBart Van AsscheWindows may open a file in text rather than binary mode).
913*44704f69SBart Van Assche<P>
914*44704f69SBart Van Assche
915*44704f69SBart Van AsscheSome utilities that the author has found useful have been placed in
916*44704f69SBart Van Asschethe 'utils' subdirectory.
917*44704f69SBart Van Assche<A NAME="lbAQ">&nbsp;</A>
918*44704f69SBart Van Assche<H2>WEB SITE</H2>
919*44704f69SBart Van Assche
920*44704f69SBart Van AsscheThere is a web page discussing this package at
921*44704f69SBart Van Assche<A HREF="https://sg.danny.cz/sg/sg3_utils.html">https://sg.danny.cz/sg/sg3_utils.html</A> . The device naming used by this
922*44704f69SBart Van Asschepackage on various operating systems is discussed at:
923*44704f69SBart Van Assche<A HREF="https://sg.danny.cz/sg/device_name.html">https://sg.danny.cz/sg/device_name.html</A> . There is a git code mirror at
924*44704f69SBart Van Assche<A HREF="https://github.com/hreinecke/sg3_utils">https://github.com/hreinecke/sg3_utils</A> . The principle code repository
925*44704f69SBart Van Asscheuses subversion and is on the author's equipment. The author keeps track
926*44704f69SBart Van Asscheof this via the subversion revision number which is an ascending integer
927*44704f69SBart Van Assche(currently at 774 for this package). The github mirror gets updated
928*44704f69SBart Van Asscheperiodically from the author's repository. Depending on the time of
929*44704f69SBart Van Asscheupdate, the above Downloads section at sg.danny.cz may be more up to
930*44704f69SBart Van Asschedate than the github mirror.
931*44704f69SBart Van Assche<A NAME="lbAR">&nbsp;</A>
932*44704f69SBart Van Assche<H2>AUTHORS</H2>
933*44704f69SBart Van Assche
934*44704f69SBart Van AsscheWritten by Douglas Gilbert. Some utilities have been contributed, see the
935*44704f69SBart Van AsscheCREDITS file and individual source files (in the 'src' directory).
936*44704f69SBart Van Assche<A NAME="lbAS">&nbsp;</A>
937*44704f69SBart Van Assche<H2>REPORTING BUGS</H2>
938*44704f69SBart Van Assche
939*44704f69SBart Van AsscheReport bugs to &lt;dgilbert at interlog dot com&gt;.
940*44704f69SBart Van Assche<A NAME="lbAT">&nbsp;</A>
941*44704f69SBart Van Assche<H2>COPYRIGHT</H2>
942*44704f69SBart Van Assche
943*44704f69SBart Van AsscheCopyright &#169; 1999-2021 Douglas Gilbert
944*44704f69SBart Van Assche<BR>
945*44704f69SBart Van Assche
946*44704f69SBart Van AsscheSome utilities are distributed under a GPL version 2 license while
947*44704f69SBart Van Asscheothers, usually more recent ones, are under a FreeBSD license. The files
948*44704f69SBart Van Asschethat are common to almost all utilities and thus contain the most reusable
949*44704f69SBart Van Asschecode, namely sg_lib.[hc], sg_cmds_basic.[hc] and sg_cmds_extra.[hc] are
950*44704f69SBart Van Asscheunder a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY
951*44704f69SBart Van Asscheor FITNESS FOR A PARTICULAR PURPOSE.
952*44704f69SBart Van Assche<A NAME="lbAU">&nbsp;</A>
953*44704f69SBart Van Assche<H2>SEE ALSO</H2>
954*44704f69SBart Van Assche
955*44704f69SBart Van Assche<B>sdparm(sdparm), ddpt(ddpt), lsscsi(lsscsi), <A HREF="../man1/dmesg.1.html">dmesg</A>(1), <A HREF="../man1/mt.1.html">mt</A>(1)</B>
956*44704f69SBart Van Assche
957*44704f69SBart Van Assche<P>
958*44704f69SBart Van Assche
959*44704f69SBart Van Assche<HR>
960*44704f69SBart Van Assche<A NAME="index">&nbsp;</A><H2>Index</H2>
961*44704f69SBart Van Assche<DL>
962*44704f69SBart Van Assche<DT><A HREF="#lbAB">NAME</A><DD>
963*44704f69SBart Van Assche<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
964*44704f69SBart Van Assche<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
965*44704f69SBart Van Assche<DT><A HREF="#lbAE">ENVIRONMENT VARIABLES</A><DD>
966*44704f69SBart Van Assche<DT><A HREF="#lbAF">LINUX DEVICE NAMING</A><DD>
967*44704f69SBart Van Assche<DT><A HREF="#lbAG">WINDOWS DEVICE NAMING</A><DD>
968*44704f69SBart Van Assche<DT><A HREF="#lbAH">FREEBSD DEVICE NAMING</A><DD>
969*44704f69SBart Van Assche<DT><A HREF="#lbAI">SOLARIS DEVICE NAMING</A><DD>
970*44704f69SBart Van Assche<DT><A HREF="#lbAJ">NVME SUPPORT</A><DD>
971*44704f69SBart Van Assche<DT><A HREF="#lbAK">EXIT STATUS</A><DD>
972*44704f69SBart Van Assche<DT><A HREF="#lbAL">COMMON OPTIONS</A><DD>
973*44704f69SBart Van Assche<DT><A HREF="#lbAM">NUMERIC ARGUMENTS</A><DD>
974*44704f69SBart Van Assche<DT><A HREF="#lbAN">FORMAT OF FILES CONTAINING ASCII HEX</A><DD>
975*44704f69SBart Van Assche<DT><A HREF="#lbAO">MICROCODE AND FIRMWARE</A><DD>
976*44704f69SBart Van Assche<DT><A HREF="#lbAP">SCRIPTS, EXAMPLES and UTILS</A><DD>
977*44704f69SBart Van Assche<DT><A HREF="#lbAQ">WEB SITE</A><DD>
978*44704f69SBart Van Assche<DT><A HREF="#lbAR">AUTHORS</A><DD>
979*44704f69SBart Van Assche<DT><A HREF="#lbAS">REPORTING BUGS</A><DD>
980*44704f69SBart Van Assche<DT><A HREF="#lbAT">COPYRIGHT</A><DD>
981*44704f69SBart Van Assche<DT><A HREF="#lbAU">SEE ALSO</A><DD>
982*44704f69SBart Van Assche</DL>
983*44704f69SBart Van Assche<HR>
984*44704f69SBart Van AsscheThis document was created by
985*44704f69SBart Van Assche<A HREF="/cgi-bin/man/man2html">man2html</A>,
986*44704f69SBart Van Asscheusing the manual pages.<BR>
987*44704f69SBart Van AsscheTime: 03:12:28 GMT, November 11, 2021
988*44704f69SBart Van Assche</BODY>
989*44704f69SBart Van Assche</HTML>
990