Name
lsscsi - list SCSI devices (or hosts) and their attributesSynopsis
H H Software Scsi & Raid Devices Driver Download For Windows 8.1
Scsi.h header.; 2 minutes to read; In this article. This header is used by storage. For more information, see: Storage scsi.h contains the following.
lsscsi [--classic- Sign in to add and modify your software. Sign in with Facebook Sign in with email. Adaptec AHA-151X/AHA-152X or AIC-6260/AIC-6360 SCSI Host Adapter (non-pnp) Free. SCSIAdapter driver.
- H H Virtual Cd Scsi Controller Sdk free download - Circle Virtual CD, CD Copy, Sonic CD, and many more programs.
H H Software Scsi Updater
] [--verbose][--version] [H:C:T:L]Description
Uses information in sysfs (linux kernel series 2.6 and later) to list scsi devices (or hosts) currently attached to the system. Options can be used tocontrol the amount and form of information provided for each device.
If a H:C:T:L argument is given then it acts as a filter and only devices that match it are listed. The colons don't have to be present, and '-', '*','?' or missing arguments at the end are interpreted as wildcards. '-' needs to stand alone or else it is taken as the beginning of an option (e.g. '-:-:-:-' isillegal). '*' needs to be escaped from the shell. A leading '[' and trailing ']' are permitted (e.g. '[1:0:0]' matches all luns on 1:0:0). May also be used tofilter --hosts in which case only the H is active and may be either a number or in the form 'host<n>' where <n> is a host number.
By default in this utility device node names (e.g. '/dev/sda' or '/dev/root_disk') are obtained by noting the major and minor numbers for the listed deviceobtained from sysfs (e.g. the contents of '/sys/block/sda/dev') and then looking for a match in the '/dev' directory. This 'match by major and minor' willallow devices that have been given a different name by udev (for example) to be correctly reported by this utility.
In some situations it may be useful to see the device node name that linux would produce by default, so the --kname option is provided. An example ofwhere this may be useful is kernel error logs which tend to report disk error messages using the disk's default kernel name.
Information about this utility including examples can also be found at: http://sg.danny.cz/scsi/lsscsi.html .
Options
- -d, --device
- After outputting the (probable) scsi device name the device node major and minor numbers are shown in brackets (e.g. '/dev/sda[8:0]').
- -g, --generic
- Output the scsi generic device file name. Note that if the sg driver is a module it may need to be loaded otherwise '-' may appear.
- -h, --help
- Output the usage message and exit.
- -H, --hosts
- List the SCSI hosts currently attached to the system. If this option is not given then SCSI devices are listed.
- -k, --kname
- Use linux default algorithm for naming devices (e.g. block major 8, minor 0 is '/dev/sda') rather than the 'match by major and minor' in the '/dev'directory as discussed above.
- -L, --list
- Output additional information in <attribute_name>=<value> pairs, one pair per line preceded by two spaces. This option has the same effect as'-lll'
- -l, --long
- Output additional information for each SCSI device (host). Can be used multiple times for more output in which case the shorter option form is moreconvenient (e.g. '-lll'). When used three times (i.e. '-lll') outputs SCSI device (host) attributes one per line; preceded by two spaces; in the form'<attribute_name>=<value>'.
- -p, --protection
- Output additional data integrity (protection) information.
- -t, --transport
- Output transport information. This will be a target related information or, if --hosts is given, initiator related information. When used without--list, a name or identifier (or both) are output on a single line, usually prefixed by the type of transport. For devices this information replaces thenormal vendor, product and revision strings. When the --list option is also given then additionally multiple lines of attribute_name=value pairs areouput, each indented by two spaces. See the section on transports below.
- -v, --verbose
- outputs directory names where information is found. Use multiple times for more output.
- -V, --version
- outputs version information then exits.
- -y, --sysfsroot=PATH
- assumes sysfs is mounted at PATH instead of the default '/sys' . If this option is given PATH should be an absolute path (i.e. start with '/').
Notes
Information for this command is derived from the sysfs file system, which is assumed to be mounted at/sys unless specified otherwise by the user. SCSI (pseudo) devices that have been detected by the SCSI mid level will be listed even if the required upperlevel drivers (i.e. sd, sr, st, osst or ch) have not been loaded. If the appropriate upper level driver has not been loaded then the device file name willappear as '-' rather than something like '/dev/st0'. Note that some devices (e.g. scanners and medium changers) do not have a primary upper level driver andcan only be accessed via a scsi generic (sg) device name.lsscsi version 0.21 or later is required to correctly display SCSI devices in linux kernel 2.6.26 (and possibly later) when the CONFIG_SYSFS_DEPRECATED_V2kernel option is not defined.
Transports
This utility lists SCSI devices which are known as logical units (lu) in the SCSIArchitecture Model (ref: SAM-4 at http://www.t10.org) or hosts when the --hosts option is given. A host is called an initiator in SAM-4. A SCSI commandtravels out via an initiator, across some transport to a target and then onwards to a logical unit. A target device may contain several logical units. A targetdevice has one or more ports that can be viewed as transport end points. Each FC and SAS disk is a single target that has two ports and contains one logicalunit. If both target ports on a FC or SAS disk are connected and visible to a machine, then lsscsi will show two entries. Initiators (i.e. hosts) also have oneor more ports and some HBAs in Linux have a host entry per initiator port while others have a host entry per initiator device.When the --transport option is given for devices (i.e. --hosts not given) then most of the information produced by lsscsi is associated withthe target, or more precisely: the target port, through which SCSI commands pass that access a logical unit.
Typically this utility provides one line of output per 'device' or host. Significantly more information can be obtained by adding the --list option.When used together with the --transport option, after the summary line, multiple lines of transport specific information in the form'<attribute_name>=<value>' are output, each indented by two spaces. Using a filter argument will reduce the volume of output if a lot of devices orhosts are present.
The transports that are currently recognized are: IEEE 1394, ATA, FC, iSCSI, SAS, SATA, SPI and USB.
For IEEE 1394 (a.k.a. Firewire and 'SBP' when storage is involved), the EUI-64 based target port name is output when --transport is given, in theabsence of the --hosts option. When the --hosts option is given then the EUI-64 initiator port name is output. Output on the summary linespecific to the IEEE 1394 transport is prefixed by 'sbp:'.
to detect ATA and SATA a crude check is performed on the driver name (after the checks for other transports are exhausted). Based on the driver name eitherATA or SATA transport type is chosen. Output on the summary line is either 'ata:' or 'sata:'. No other attributes are given. Most device and hosts flagged as'ata:' will use the parallel ATA transport (PATA).
For Fibre Channel (FC) the port name and port identifier are output when --transport is given. In the absence of the --hosts option these idswill be for the target port associated with the device (logical unit) being listed. When the --hosts option is given then the ids are for the initiatorport used by the host. Output on the summary line specific to the FC transport is prefixed by 'fc:'.
For iSCSI the target port name is output when --transport is given, in the absence of the --hosts option. This is made up of the iSCSI nameand the target portal group tag. Since the iSCSI name starts with 'iqn' no further prefix is used. When the --hosts option is given then only 'iscsi:'is output on the summary line.
For Serial Attached SCSI the SAS address of the target port (or initiator port if --hosts option is also given) is output. This will be a naa-5address. For SAS HBAs and SAS targets (such as SAS disks and tape drives) the SAS address will be world wide unique. For SATA disks attached to a SAS expander,the expander provides the SAS address by adding a non zero value to its (i.e. the expander's) SAS address (e.g. expander_sas_address + phy_id + 1). SATA disksdirectly attached to SAS HBAs seem to have an indeterminate SAS address. Output on the summary line specific to the SAS transport is prefixed by 'sas:'.
For the SCSI Parallel Interface (SPI) the target port identifier (usually a number between 0 and 15 inclusive) is output when --transport is given,in the absence of the --hosts option. When the --hosts option is given then only 'spi:' is output on the summary line.
When a USB transport is detected, the summary line will contain 'usb:' followed by a USB device name. The USB device name has the form'<b>-<p1>[.<p2>[.<p3>]]:<c>.<i>' where <b> is the USB bus number, <p1> is the port on the host. <p2> is aport on a host connected hub, if present. If needed <p3> is a USB hub port closer to the USB storage device. <c> refers to the configuration numberwhile <i> is the interface number. There is a separate SCSI host for each USB (SCSI) target. A USB SCSI target may contain multiple logical units. Thusthe same 'usb: <device_name>' string appears for a USB SCSI host and all logical units that belong to the USB SCSI target associated with that USB SCSIhost.
Author
Written by Doug GilbertReporting Bugs
Report bugs to <dgilbert at interlog dot com>.Copyright
Copyright © 2003-2009 Douglas GilbertThis software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See Also
lspci lsusbWarning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* Copyright (C) 1997-2019 Free Software Foundation, Inc. |
---|---|
2 | This file is part of the GNU C Library. |
3 | |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2.1 of the License, or (at your option) any later version. |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ |
17 | |
18 | /* |
19 | History: |
20 | Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user |
21 | process control of SCSI devices. |
22 | Development Sponsored by Killy Corp. NY NY |
23 | */ |
24 | |
25 | #ifndef_SCSI_SG_H |
26 | #define _SCSI_SG_H 1 |
27 | |
28 | #include <features.h> |
29 | #define __need_size_t |
30 | #include <stddef.h> |
31 | |
32 | |
33 | /* New interface introduced in the 3.x SG drivers follows */ |
34 | |
35 | /* Same structure as used by readv() Linux system call. It defines one |
36 | scatter-gather element. */ |
37 | typedefstructsg_iovec |
38 | { |
39 | void * iov_base; /* Starting address */ |
40 | size_tiov_len; /* Length in bytes */ |
41 | } sg_iovec_t; |
42 | |
43 | |
44 | typedefstructsg_io_hdr |
45 | { |
46 | intinterface_id; /* [i] 'S' for SCSI generic (required) */ |
47 | intdxfer_direction; /* [i] data transfer direction */ |
48 | unsignedcharcmd_len; /* [i] SCSI command length ( <= 16 bytes) */ |
49 | unsignedcharmx_sb_len; /* [i] max length to write to sbp */ |
50 | unsignedshortintiovec_count; /* [i] 0 implies no scatter gather */ |
51 | unsignedintdxfer_len; /* [i] byte count of data transfer */ |
52 | void * dxferp; /* [i], [*io] points to data transfer memory |
53 | or scatter gather list */ |
54 | unsignedchar * cmdp; /* [i], [*i] points to command to perform */ |
55 | unsignedchar * sbp; /* [i], [*o] points to sense_buffer memory */ |
56 | unsignedinttimeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ |
57 | unsignedintflags; /* [i] 0 -> default, see SG_FLAG... */ |
58 | intpack_id; /* [i->o] unused internally (normally) */ |
59 | void * usr_ptr; /* [i->o] unused internally */ |
60 | unsignedcharstatus; /* [o] scsi status */ |
61 | unsignedcharmasked_status;/* [o] shifted, masked scsi status */ |
62 | unsignedcharmsg_status; /* [o] messaging level data (optional) */ |
63 | unsignedcharsb_len_wr; /* [o] byte count actually written to sbp */ |
64 | unsignedshortinthost_status; /* [o] errors from host adapter */ |
65 | unsignedshortintdriver_status;/* [o] errors from software driver */ |
66 | intresid; /* [o] dxfer_len - actual_transferred */ |
67 | unsignedintduration; /* [o] time taken by cmd (unit: millisec) */ |
68 | unsignedintinfo; /* [o] auxiliary information */ |
69 | } sg_io_hdr_t; |
70 | |
71 | |
72 | /* Use negative values to flag difference from original sg_header structure. */ |
73 | #define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ |
74 | #define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ |
75 | #define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ |
76 | #define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the |
77 | additional property than during indirect |
78 | IO the user buffer is copied into the |
79 | kernel buffers before the transfer */ |
80 | |
81 | |
82 | /* following flag values can be 'or'-ed together */ |
83 | #define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ |
84 | #define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ |
85 | /* the 2nd byte of SCSI command */ |
86 | #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ |
87 | /* user space (debug indirect IO) */ |
88 | |
89 | /* The following 'info' values are 'or'-ed together. */ |
90 | #define SG_INFO_OK_MASK 0x1 |
91 | #define SG_INFO_OK 0x0 /* no sense, host nor driver 'noise' */ |
92 | #define SG_INFO_CHECK 0x1 /* something abnormal happened */ |
93 | |
94 | #define SG_INFO_DIRECT_IO_MASK 0x6 |
95 | #define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ |
96 | #define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ |
97 | #define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ |
98 | |
99 | |
100 | /* Request information about a specific SG device, used by |
101 | SG_GET_SCSI_ID ioctl (). */ |
102 | structsg_scsi_id { |
103 | /* Host number as in 'scsi<n>' where 'n' is one of 0, 1, 2 etc. */ |
104 | inthost_no; |
105 | intchannel; |
106 | /* SCSI id of target device. */ |
107 | intscsi_id; |
108 | intlun; |
109 | /* TYPE_... defined in <scsi/scsi.h>. */ |
110 | intscsi_type; |
111 | /* Host (adapter) maximum commands per lun. */ |
112 | shortinth_cmd_per_lun; |
113 | /* Device (or adapter) maximum queue length. */ |
114 | shortintd_queue_depth; |
115 | /* Unused, set to 0 for now. */ |
116 | intunused[2]; |
117 | }; |
118 | |
119 | /* Used by SG_GET_REQUEST_TABLE ioctl(). */ |
120 | typedefstructsg_req_info { |
121 | charreq_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ |
122 | charorphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ |
123 | charsg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ |
124 | charproblem; /* 0 -> no problem detected, 1 -> error to report */ |
125 | intpack_id; /* pack_id associated with request */ |
126 | void * usr_ptr; /* user provided pointer (in new interface) */ |
127 | unsignedintduration; /* millisecs elapsed since written (req_state1) |
128 | or request duration (req_state2) */ |
129 | intunused; |
130 | } sg_req_info_t; |
131 | |
132 | |
133 | /* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. |
134 | [Those that only apply to the SG 2.x drivers are at the end of the file.] |
135 | (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ |
136 | |
137 | #define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ |
138 | |
139 | /* Used to configure SCSI command transformation layer for ATAPI devices */ |
140 | /* Only supported by the ide-scsi driver */ |
141 | #define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ |
142 | /* 3rd arg = 0 to disable transform, 1 to enable it */ |
143 | #define SG_GET_TRANSFORM 0x2205 |
144 | |
145 | #define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ |
146 | #define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ |
147 | |
148 | /* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ |
149 | #define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ |
150 | /* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ |
151 | |
152 | /* Override host setting and always DMA using low memory ( <16MB on i386) */ |
153 | #define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ |
154 | #define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ |
155 | |
156 | /* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which |
157 | tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. |
158 | If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 |
159 | then pack_id ignored by read() and oldest readable fetched. */ |
160 | #define SG_SET_FORCE_PACK_ID 0x227b |
161 | #define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ |
162 | |
163 | #define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ |
164 | |
165 | /* Yields max scatter gather tablesize allowed by current host adapter */ |
166 | #define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ |
167 | |
168 | #define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ |
169 | |
170 | /* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ |
171 | #define SG_SCSI_RESET 0x2284 |
172 | /* Associated values that can be given to SG_SCSI_RESET follow */ |
173 | #define SG_SCSI_RESET_NOTHING 0 |
174 | #define SG_SCSI_RESET_DEVICE 1 |
175 | #define SG_SCSI_RESET_BUS 2 |
176 | #define SG_SCSI_RESET_HOST 3 |
177 | |
178 | /* synchronous SCSI command ioctl, (only in version 3 interface) */ |
179 | #define SG_IO 0x2285 /* similar effect as write() followed by read() */ |
180 | |
181 | #define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ |
182 | |
183 | /* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ |
184 | #define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ |
185 | #define SG_GET_KEEP_ORPHAN 0x2288 |
186 | |
187 | |
188 | #define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ |
189 | /* Largest size (in bytes) a single scatter-gather list element can have. |
190 | The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on |
191 | i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported |
192 | by adapter then this value is the largest data block that can be |
193 | read/written by a single scsi command. The user can find the value of |
194 | PAGE_SIZE by calling getpagesize() defined in unistd.h . */ |
195 | |
196 | #define SG_DEFAULT_RETRIES 1 |
197 | |
198 | /* Defaults, commented if they differ from original sg driver */ |
199 | #define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ |
200 | #define SG_DEF_FORCE_PACK_ID 0 |
201 | #define SG_DEF_KEEP_ORPHAN 0 |
202 | #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ |
203 | |
204 | /* maximum outstanding requests, write() yields EDOM if exceeded */ |
205 | #define SG_MAX_QUEUE 16 |
206 | |
207 | #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ |
208 | |
209 | /* Alternate style type names, '..._t' variants preferred */ |
210 | typedefstructsg_io_hdrSg_io_hdr; |
211 | typedefstructsg_io_vecSg_io_vec; |
212 | typedefstructsg_scsi_idSg_scsi_id; |
213 | typedefstructsg_req_infoSg_req_info; |
214 | |
215 | |
216 | /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ |
217 | /* The older SG interface based on the 'sg_header' structure follows. */ |
218 | /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ |
219 | |
220 | #define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ |
221 | |
222 | structsg_header |
223 | { |
224 | /* Length of incoming packet (including header). */ |
225 | intpack_len; |
226 | /* Maximal length of expected reply. */ |
227 | intreply_len; |
228 | /* Id number of packet. */ |
229 | intpack_id; |
230 | /* 0ok, otherwise error number. */ |
231 | intresult; |
232 | /* Force 12 byte command length for group 6 & 7 commands. */ |
233 | unsignedinttwelve_byte:1; |
234 | /* SCSI status from target. */ |
235 | unsignedinttarget_status:5; |
236 | /* Host status (see 'DID' codes). */ |
237 | unsignedinthost_status:8; |
238 | /* Driver status+suggestion. */ |
239 | unsignedintdriver_status:8; |
240 | /* Unused. */ |
241 | unsignedintother_flags:10; |
242 | /* Output in 3 cases: |
243 | when target_status is CHECK_CONDITION or |
244 | when target_status is COMMAND_TERMINATED or |
245 | when (driver_status & DRIVER_SENSE) is true. */ |
246 | unsignedcharsense_buffer[SG_MAX_SENSE]; |
247 | }; |
248 | |
249 | |
250 | /* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t |
251 | interface is used. They are kept for backward compatibility with |
252 | the original and version 2 drivers. */ |
253 | |
254 | #define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)argtimeout. */ |
255 | #define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ |
256 | |
257 | /* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ |
258 | #define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ |
259 | #define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ |
260 | |
261 | /* Turn on error sense trace (1..8), dump this device to log/console (9) |
262 | or dump all sg device states ( >9 ) to log/console. */ |
263 | #define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ |
264 | |
265 | #define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given |
266 | number on the next write() on this file |
267 | descriptor. */ |
268 | |
269 | /* Defaults, commented if they differ from original sg driver */ |
270 | #define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ 'jiffies in 1 second' */ |
271 | #define SG_DEF_COMMAND_Q 0 /* command queuing is always on when |
272 | the new interface is used */ |
273 | #define SG_DEF_UNDERRUN_FLAG 0 |
274 | |
275 | |
276 | #endif /* scsi/sg.h */ |
277 |
Warning: That file was not part of the compilation database. It may have many parsing errors.