1lsscsi(8) LSSCSI lsscsi(8)
2
3
4
6 lsscsi - list SCSI devices (or hosts) and their attributes
7
9 lsscsi [--classic] [--device] [--generic] [--help] [--hosts] [--kname]
10 [--list] [--long] [--protection] [--sysfsroot=PATH] [--transport]
11 [--verbose] [--version] [H:C:T:L]
12
14 Uses information in sysfs (linux kernel series 2.6 and later) to list
15 scsi devices (or hosts) currently attached to the system. Options can
16 be used to control the amount and form of information provided for each
17 device.
18
19 If a H:C:T:L argument is given then it acts as a filter and only
20 devices that match it are listed. The colons don't have to be present,
21 and '-', '*', '?' or missing arguments at the end are interpreted as
22 wildcards. '-' needs to stand alone or else it is taken as the begin‐
23 ning of an option (e.g. '-:-:-:-' is illegal). '*' needs to be escaped
24 from the shell. A leading '[' and trailing ']' are permitted (e.g.
25 '[1:0:0]' matches all luns on 1:0:0). May also be used to filter
26 --hosts in which case only the H is active and may be either a number
27 or in the form "host<n>" where <n> is a host number.
28
29 By default in this utility device node names (e.g. "/dev/sda" or
30 "/dev/root_disk") are obtained by noting the major and minor numbers
31 for the listed device obtained from sysfs (e.g. the contents of
32 "/sys/block/sda/dev") and then looking for a match in the "/dev" direc‐
33 tory. This "match by major and minor" will allow devices that have been
34 given a different name by udev (for example) to be correctly reported
35 by this utility.
36
37 In some situations it may be useful to see the device node name that
38 linux would produce by default, so the --kname option is provided. An
39 example of where this may be useful is kernel error logs which tend to
40 report disk error messages using the disk's default kernel name.
41
42 Information about this utility including examples can also be found at:
43 http://sg.danny.cz/scsi/lsscsi.html .
44
46 -c, --classic
47 The output is similar to that obtained from 'cat
48 /proc/scsi/scsi'
49
50 -d, --device
51 After outputting the (probable) scsi device name the device node
52 major and minor numbers are shown in brackets (e.g.
53 "/dev/sda[8:0]").
54
55 -g, --generic
56 Output the scsi generic device file name. Note that if the sg
57 driver is a module it may need to be loaded otherwise '-' may
58 appear.
59
60 -h, --help
61 Output the usage message and exit.
62
63 -H, --hosts
64 List the SCSI hosts currently attached to the system. If this
65 option is not given then SCSI devices are listed.
66
67 -k, --kname
68 Use linux default algorithm for naming devices (e.g. block major
69 8, minor 0 is "/dev/sda") rather than the "match by major and
70 minor" in the "/dev" directory as discussed above.
71
72 -L, --list
73 Output additional information in <attribute_name>=<value> pairs,
74 one pair per line preceded by two spaces. This option has the
75 same effect as '-lll'
76
77 -l, --long
78 Output additional information for each SCSI device (host). Can
79 be used multiple times for more output in which case the shorter
80 option form is more convenient (e.g. '-lll'). When used three
81 times (i.e. '-lll') outputs SCSI device (host) attributes one
82 per line; preceded by two spaces; in the form
83 "<attribute_name>=<value>".
84
85 -p, --protection
86 Output additional data integrity (protection) information.
87
88 -t, --transport
89 Output transport information. This will be a target related
90 information or, if --hosts is given, initiator related informa‐
91 tion. When used without --list, a name or identifier (or both)
92 are output on a single line, usually prefixed by the type of
93 transport. For devices this information replaces the normal ven‐
94 dor, product and revision strings. When the --list option is
95 also given then additionally multiple lines of
96 attribute_name=value pairs are ouput, each indented by two spa‐
97 ces. See the section on transports below.
98
99 -v, --verbose
100 outputs directory names where information is found. Use multiple
101 times for more output.
102
103 -V, --version
104 outputs version information then exits.
105
106 -y, --sysfsroot=PATH
107 assumes sysfs is mounted at PATH instead of the default '/sys' .
108 If this option is given PATH should be an absolute path (i.e.
109 start with '/').
110
112 Information for this command is derived from the sysfs file system,
113 which is assumed to be mounted at /sys unless specified otherwise by
114 the user. SCSI (pseudo) devices that have been detected by the SCSI
115 mid level will be listed even if the required upper level drivers (i.e.
116 sd, sr, st, osst or ch) have not been loaded. If the appropriate upper
117 level driver has not been loaded then the device file name will appear
118 as '-' rather than something like '/dev/st0'. Note that some devices
119 (e.g. scanners and medium changers) do not have a primary upper level
120 driver and can only be accessed via a scsi generic (sg) device name.
121
122 lsscsi version 0.21 or later is required to correctly display SCSI
123 devices in linux kernel 2.6.26 (and possibly later) when the CON‐
124 FIG_SYSFS_DEPRECATED_V2 kernel option is not defined.
125
127 This utility lists SCSI devices which are known as logical units (lu)
128 in the SCSI Architecture Model (ref: SAM-4 at http://www.t10.org) or
129 hosts when the --hosts option is given. A host is called an initiator
130 in SAM-4. A SCSI command travels out via an initiator, across some
131 transport to a target and then onwards to a logical unit. A target
132 device may contain several logical units. A target device has one or
133 more ports that can be viewed as transport end points. Each FC and SAS
134 disk is a single target that has two ports and contains one logical
135 unit. If both target ports on a FC or SAS disk are connected and visi‐
136 ble to a machine, then lsscsi will show two entries. Initiators (i.e.
137 hosts) also have one or more ports and some HBAs in Linux have a host
138 entry per initiator port while others have a host entry per initiator
139 device.
140
141 When the --transport option is given for devices (i.e. --hosts not
142 given) then most of the information produced by lsscsi is associated
143 with the target, or more precisely: the target port, through which SCSI
144 commands pass that access a logical unit.
145
146 Typically this utility provides one line of output per "device" or
147 host. Significantly more information can be obtained by adding the
148 --list option. When used together with the --transport option, after
149 the summary line, multiple lines of transport specific information in
150 the form "<attribute_name>=<value>" are output, each indented by two
151 spaces. Using a filter argument will reduce the volume of output if a
152 lot of devices or hosts are present.
153
154 The transports that are currently recognized are: IEEE 1394, ATA, FC,
155 iSCSI, SAS, SATA, SPI and USB.
156
157 For IEEE 1394 (a.k.a. Firewire and "SBP" when storage is involved), the
158 EUI-64 based target port name is output when --transport is given, in
159 the absence of the --hosts option. When the --hosts option is given
160 then the EUI-64 initiator port name is output. Output on the summary
161 line specific to the IEEE 1394 transport is prefixed by "sbp:".
162
163 to detect ATA and SATA a crude check is performed on the driver name
164 (after the checks for other transports are exhausted). Based on the
165 driver name either ATA or SATA transport type is chosen. Output on the
166 summary line is either "ata:" or "sata:". No other attributes are
167 given. Most device and hosts flagged as "ata:" will use the parallel
168 ATA transport (PATA).
169
170 For Fibre Channel (FC) the port name and port identifier are output
171 when --transport is given. In the absence of the --hosts option these
172 ids will be for the target port associated with the device (logical
173 unit) being listed. When the --hosts option is given then the ids are
174 for the initiator port used by the host. Output on the summary line
175 specific to the FC transport is prefixed by "fc:".
176
177 For iSCSI the target port name is output when --transport is given, in
178 the absence of the --hosts option. This is made up of the iSCSI name
179 and the target portal group tag. Since the iSCSI name starts with "iqn"
180 no further prefix is used. When the --hosts option is given then only
181 "iscsi:" is output on the summary line.
182
183 For Serial Attached SCSI the SAS address of the target port (or initia‐
184 tor port if --hosts option is also given) is output. This will be a
185 naa-5 address. For SAS HBAs and SAS targets (such as SAS disks and tape
186 drives) the SAS address will be world wide unique. For SATA disks
187 attached to a SAS expander, the expander provides the SAS address by
188 adding a non zero value to its (i.e. the expander's) SAS address (e.g.
189 expander_sas_address + phy_id + 1). SATA disks directly attached to SAS
190 HBAs seem to have an indeterminate SAS address. Output on the summary
191 line specific to the SAS transport is prefixed by "sas:".
192
193 For the SCSI Parallel Interface (SPI) the target port identifier (usu‐
194 ally a number between 0 and 15 inclusive) is output when --transport is
195 given, in the absence of the --hosts option. When the --hosts option is
196 given then only "spi:" is output on the summary line.
197
198 When a USB transport is detected, the summary line will contain "usb:"
199 followed by a USB device name. The USB device name has the form
200 "<b>-<p1>[.<p2>[.<p3>]]:<c>.<i>" where <b> is the USB bus number, <p1>
201 is the port on the host. <p2> is a port on a host connected hub, if
202 present. If needed <p3> is a USB hub port closer to the USB storage
203 device. <c> refers to the configuration number while <i> is the inter‐
204 face number. There is a separate SCSI host for each USB (SCSI) target.
205 A USB SCSI target may contain multiple logical units. Thus the same
206 "usb: <device_name>" string appears for a USB SCSI host and all logical
207 units that belong to the USB SCSI target associated with that USB SCSI
208 host.
209
211 Written by Doug Gilbert
212
214 Report bugs to <dgilbert at interlog dot com>.
215
217 Copyright © 2003-2009 Douglas Gilbert
218 This software is distributed under the GPL version 2. There is NO war‐
219 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
220 POSE.
221
223 lspci lsusb
224
225
226
227lsscsi-0.23 November 2009 lsscsi(8)