Blame doc/lsscsi.8

Packit Service 336c1b
.TH lsscsi "8" "November 2020" "lsscsi\-0.32" LSSCSI
Packit Service 336c1b
.SH NAME
Packit Service 336c1b
lsscsi \- list SCSI devices (or hosts), list NVMe devices
Packit Service 336c1b
.SH SYNOPSIS
Packit Service 336c1b
.B lsscsi
Packit Service 336c1b
[\fI\-\-brief\fR] [\fI\-\-classic\fR] [\fI\-\-controllers\fR]
Packit Service 336c1b
[\fI\-\-device\fR] [\fI\-\-generic\fR] [\fI\-\-help\fR] [\fI\-\-hosts\fR]
Packit Service 336c1b
[\fI\-\-kname\fR] [\fI\-\-list\fR] [\fI\-\-long\fR] [\fI\-\-long\-unit\fR]
Packit Service 336c1b
[\fI\-\-lunhex\fR] [\fI\-\-no\-nvme\fR] [\fI\-\-pdt\fR] [\fI\-\-protection\fR]
Packit Service 336c1b
[\fI\-\-protmode\fR] [\fI\-\-scsi_id\fR] [\fI\-\-size\fR]
Packit Service 336c1b
[\fI\-\-sysfsroot=PATH\fR] [\fI\-\-sz\-lbs] [\fI\-\-transport\fR]
Packit Service 336c1b
[\fI\-\-unit\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR] [\fI\-\-wwn\fR]
Packit Service 336c1b
[\fIH:C:T:L\fR]
Packit Service 336c1b
.SH DESCRIPTION
Packit Service 336c1b
.\" Add any additional description here
Packit Service 336c1b
.PP
Packit Service 336c1b
Uses information in sysfs (Linux kernel series 2.6 and later) to list SCSI
Packit Service 336c1b
devices (or hosts) currently attached to the system. Many non\-SCSI storage
Packit Service 336c1b
devices (but not all) used the SCSI subsystem in Linux. In lsscsi version
Packit Service 336c1b
0.30 support was added to list NVMe devices.
Packit Service 336c1b
.PP
Packit Service 336c1b
In single line per device (LU or NVMe namespace) mode, the default, each
Packit Service 336c1b
line starts with a 4 element tuple surrounded by square brackets. For SCSI
Packit Service 336c1b
devices the first element 'H' is the host number, the second element 'C' is
Packit Service 336c1b
the controller number, the third element 'T' is the target number and the
Packit Service 336c1b
final element is the Logical Unit Number (LUN). All four are integers.
Packit Service 336c1b
For NVMe namespaces see two paragraphs down. When the \fI\-\-hosts\fR option
Packit Service 336c1b
is given for SCSI devices the tuple is reduced to one element: the host
Packit Service 336c1b
number.
Packit Service 336c1b
.PP
Packit Service 336c1b
If a \fIH:C:T:L\fR tuple is given as an argument on the command line then
Packit Service 336c1b
it acts as a filter and only devices that match it are listed. The colons
Packit Service 336c1b
don't have to be present, and '\-', '*', '?' or missing components at the
Packit Service 336c1b
end are interpreted as wildcards. The default is '*:*:*:*' which means to
Packit Service 336c1b
match devices (i.e.  Logical Units). Any filter string using '*' of '?'
Packit Service 336c1b
should be surrounded by single or double quotes to stop shell expansions.
Packit Service 336c1b
If '\-' is used as a wildcard then the whole filter tuple should be prefixed
Packit Service 336c1b
by '\-\- ' to tell this utility there are no more options on the command
Packit Service 336c1b
line to be interpreted.  A leading '[' and trailing ']' are permitted (
Packit Service 336c1b
e.g. '[1:0:0]' matches all LUNs on 1:0:0). May also be used to filter
Packit Service 336c1b
\fI\-\-hosts\fR in which case only the \fIH\fR is active and may be either
Packit Service 336c1b
a number or in the form "host<n>" where <n> is a host number.
Packit Service 336c1b
.PP
Packit Service 336c1b
For NVMe devices and controllers almost all of the previous paragraph
Packit Service 336c1b
applies. The main difference is that "N" appears in the 'H' (first) position.
Packit Service 336c1b
The 'C' position for NVMe is the controller's Linux generated "char" device
Packit Service 336c1b
minor number which is the first number that appears in a typical NVMe
Packit Service 336c1b
controller name, for example: "/dev/nvme2". The 'T' position for NVMe is
Packit Service 336c1b
the "CNTLID" value. The final 'L' position is the NVMe namespace identifier
Packit Service 336c1b
which is typically a sequential value starting at 1. The leading explicit "N"
Packit Service 336c1b
for NVMe devices is converted internally into a large value (32,767) that
Packit Service 336c1b
should not interfere with any Linux generated SCSI host number; it also means
Packit Service 336c1b
that the numeric sort used to show hosts (controllers) and devices (LUs or
Packit Service 336c1b
logical units) will always place NVMe devices and controllers after those
Packit Service 336c1b
that use the SCSI subsystem. To filter using a \fIH:C:T:L\fR argument for
Packit Service 336c1b
NVMe controllers, "hostN", "hostN:<num>", "N" or "N:<num>" may be used; when
Packit Service 336c1b
no "<num>" is given, only NVMe controllers will be listed (i.e. it lists no
Packit Service 336c1b
SCSI hosts (HBAs)).
Packit Service 336c1b
.PP
Packit Service 336c1b
By default in this utility device node names (e.g. "/dev/sda"
Packit Service 336c1b
or "/dev/root_disk") are obtained by noting the major and minor numbers for
Packit Service 336c1b
the listed device obtained from sysfs (e.g. the contents
Packit Service 336c1b
of "/sys/block/sda/dev") and then looking for a match in the "/dev"
Packit Service 336c1b
directory. This "match by major and minor" will allow devices that have been
Packit Service 336c1b
given a different name by udev (for example) to be correctly reported by
Packit Service 336c1b
this utility.
Packit Service 336c1b
.PP
Packit Service 336c1b
In some situations it may be useful to see the device node name that
Packit Service 336c1b
Linux would produce by default, so the \fI\-\-kname\fR option is provided.
Packit Service 336c1b
An example of where this may be useful is kernel error logs which tend to
Packit Service 336c1b
report disk error messages using the disk's default kernel name.
Packit Service 336c1b
.SH OPTIONS
Packit Service 336c1b
Arguments to long options are mandatory for short options as well. The options
Packit Service 336c1b
are arranged in alphabetical order based on the long option name. Hyphenated
Packit Service 336c1b
long options can also take underscore, and vice versa (e.g. \fI\-\-scsi_id\fR
Packit Service 336c1b
or \fI\-\-scsi\-id\fR are acceptable).
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-b\fR, \fB\-\-brief\fR
Packit Service 336c1b
reduces one line per device output to the tuple and the primary device name.
Packit Service 336c1b
This may simplify scripts that process the output of this utility. With the
Packit Service 336c1b
\fI\-\-generic\fR option it will show on each line the tuple (from which
Packit Service 336c1b
the bsg pass\-through device name can be deduced), the primary device
Packit Service 336c1b
name (which the block subsystem uses) and the sg device name (also a
Packit Service 336c1b
pass\-through).
Packit Service 336c1b
.br
Packit Service 336c1b
When the \fI\-\-pdt\fR option is used together with this option the SCSI
Packit Service 336c1b
Peripheral Device Type (PDT) is displayed in hex (with a leading "0x")
Packit Service 336c1b
between the tuple and the primary device name. For NVMe namespaces "0x0"
Packit Service 336c1b
is displayed (for a disk or direct access device).
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-c\fR, \fB\-\-classic\fR
Packit Service 336c1b
The output is similar to that obtained from 'cat /proc/scsi/scsi'
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-C\fR, \fB\-\-controllers\fR
Packit Service 336c1b
Lists NVMe controllers and SCSI hosts. This is a synonym for the
Packit Service 336c1b
\fI\-\-hosts\fR option.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-d\fR, \fB\-\-device\fR
Packit Service 336c1b
After outputting the (probable) SCSI device name the device node
Packit Service 336c1b
major and minor numbers are shown in brackets (e.g. "/dev/sda[8:0]").
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-g\fR, \fB\-\-generic\fR
Packit Service 336c1b
Output the SCSI generic device file name. Note that if the sg driver
Packit Service 336c1b
is a module it may need to be loaded otherwise '\-' may appear.
Packit Service 336c1b
.br
Packit Service 336c1b
NVMe does not have generic (char) devices in the same sense as SCSI.
Packit Service 336c1b
Instead NVMe Admin, NVM (i.e. block type commands such as Read and
Packit Service 336c1b
Write) and MI (Management Interface (e.g. to an enclosure)) commands
Packit Service 336c1b
are all sent to the containing controller whose device name is shown
Packit Service 336c1b
when the \fI\-\-hosts\fR option is used.
Packit Service 336c1b
.br
Packit Service 336c1b
To unclutter the single line per device mode the \fI\-\-brief\fR option
Packit Service 336c1b
combined with this option should help.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-h\fR, \fB\-\-help\fR
Packit Service 336c1b
Output the usage message and exit.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-H\fR, \fB\-\-hosts\fR
Packit Service 336c1b
List the SCSI hosts and NVMe controllers currently attached to
Packit Service 336c1b
the system. If this option is not given (and the \fI\-\-controllers\fR
Packit Service 336c1b
option is not given) then SCSI devices (logical units (LUs)) followed by
Packit Service 336c1b
NVMe devices (namespaces) are listed.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-k\fR, \fB\-\-kname\fR
Packit Service 336c1b
Use Linux default algorithm for naming devices (e.g. block major 8,
Packit Service 336c1b
minor 0 is "/dev/sda") rather than the "match by major and minor"
Packit Service 336c1b
in the "/dev" directory as discussed above.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-L\fR, \fB\-\-list\fR
Packit Service 336c1b
Output additional information in <attribute_name>=<value> pairs, one pair
Packit Service 336c1b
per line preceded by two spaces. This option has the same effect as '\-lll'.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-l\fR, \fB\-\-long\fR
Packit Service 336c1b
Output additional information for each SCSI device (host). Can be
Packit Service 336c1b
used multiple times for more output in which case the shorter option
Packit Service 336c1b
form is more convenient (e.g. '\-lll'). When used three times (i.e. '\-lll')
Packit Service 336c1b
outputs SCSI device (host) attributes one per line; preceded by
Packit Service 336c1b
two spaces; in the form "<attribute_name>=<value>".
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-U\fR, \fB\-\-long\-unit\fR
Packit Service 336c1b
Output logical unit name in full, if available. It replaces the normal
Packit Service 336c1b
vendor, product and revision strings given in the single logical unit per
Packit Service 336c1b
line mode. If no logical unit name is found "none" is printed. If the
Packit Service 336c1b
logical unit name is long (e.g. a UUID) then following fields are pushed
Packit Service 336c1b
further to the right as required. This option is functionally equivalent to
Packit Service 336c1b
the '\-uuu' option.
Packit Service 336c1b
.br
Packit Service 336c1b
If the option is used twice (e.g. '\-UU') then EUI, NAA, UUID and T10 vendor
Packit Service 336c1b
ID formats are prefixed by "eui.", "naa.", "uuid." and "t10." respectively.
Packit Service 336c1b
Note that SCSI name format used by iSCSI should already be prefixed
Packit Service 336c1b
by 'iqn.'. Using the '\-\-unit' option 4 or more times (e.g. '\-uuuu') will
Packit Service 336c1b
have the same action as '\-UU'.
Packit Service 336c1b
.br
Packit Service 336c1b
\fI\-\-long_unit\fR is also an acceptable form when invoking this option.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-x\fR, \fB\-\-lunhex\fR
Packit Service 336c1b
when this option is used once the LUN in the tuple (at the start of each
Packit Service 336c1b
device line) is shown in "T10" format which is up to 16 hexadecimal
Packit Service 336c1b
digits. It is prefixed by "0x" to distinguish the LUN from the decimal
Packit Service 336c1b
value shown in the absence of this option. Also hierarchal LUNs are
Packit Service 336c1b
shown with a "_" character separating the levels. For example the
Packit Service 336c1b
two level LUN: 0x0355006600000000 will appear as 0x0355_0066. If this
Packit Service 336c1b
option is given twice (e.g. using the short form: '\-xx') then the full
Packit Service 336c1b
16 hexadecimal digits are shown for each LUN, prefixed by "0x".
Packit Service 336c1b
.br
Packit Service 336c1b
For NVMe, the namespace identifier (nsid) is shown in the "L" position. The
Packit Service 336c1b
nsid is a 32 bit unsigned quantities with 0x0 and 0xffffffff reserved.
Packit Service 336c1b
Without this option, the nsid is shown in decimal. When this option is used
Packit Service 336c1b
once the nsid is output in hex with a lead 0x and with up to 3 leading zeros.
Packit Service 336c1b
When this option is used twice the nsid is output in hex with up to 7 leading
Packit Service 336c1b
zeros.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-N\fR, \fB\-\-no\-nvme\fR
Packit Service 336c1b
this option excludes NVMe devices and controllers for the output. This option
Packit Service 336c1b
may be needed to stop NVMe device output interfering with specific format
Packit Service 336c1b
output like that produced when the \fI\-\-classic\fR option is used.
Packit Service 336c1b
.br
Packit Service 336c1b
To only show NVMe devices, use 'lsscsi N', to only show NVMe controllers,
Packit Service 336c1b
use 'lsscsi \-H N'.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-D\fR, \fB\-\-pdt\fR
Packit Service 336c1b
this option displays the SCSI Peripheral Device Type (PDT) in hex preceded
Packit Service 336c1b
by "0x". For NVME namespaces "0x0' is displayed which corresponds to a
Packit Service 336c1b
disk ("Direct Access Device" or SSD). In single line output this hex PDT
Packit Service 336c1b
replaces the device type abbreviation (e.g. "0x0     " replaces "disk    ")
Packit Service 336c1b
and appears after the tuple.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-p\fR, \fB\-\-protection\fR
Packit Service 336c1b
Output target (DIF) and initiator (DIX) protection types.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-P\fR, \fB\-\-protmode\fR
Packit Service 336c1b
Output effective protection information mode for each disk device.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-i\fR, \fB\-\-scsi_id\fR
Packit Service 336c1b
outputs the udev derived matching id found in /dev/disk/by\-id/scsi* .
Packit Service 336c1b
This is only for disk (and disk like) devices. If no match is found
Packit Service 336c1b
then "dm\-uuid\-mpath*" and "usb*" are searched in the same directory.
Packit Service 336c1b
If there is still no match then the /sys/class/block/<disk>/holders
Packit Service 336c1b
directory is searched. The matching id is printed following the device
Packit Service 336c1b
name (e.g.  /dev/sdc) and if there is no match "\-" is output. Note
Packit Service 336c1b
that only disk (like) devices are matched by this option; so, for
Packit Service 336c1b
example, a SCSI enclosure will have an identifier of '\-'.
Packit Service 336c1b
.br
Packit Service 336c1b
Prior to revision 164 the first match in /dev/disk/by\-id/scsi* was
Packit Service 336c1b
printed. A change was added at that point to check for identifiers
Packit Service 336c1b
in a specific order as some are considered "stronger" than others.
Packit Service 336c1b
See the ORDER OF SCSI IDENTIFIERS section below.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-s\fR, \fB\-\-size\fR
Packit Service 336c1b
Print disk capacity in human readable form. When given once, normal base
Packit Service 336c1b
10 SI units are used as a prefix for 'B' which is bytes (aka octets).
Packit Service 336c1b
For example MB, GB and TB stand for 10^6, 10^9 and 10^12 bytes
Packit Service 336c1b
respectively. When given twice, IEC 80000\-3 prefixes for 'B' are used;
Packit Service 336c1b
for example MiB, GiB and TiB stand for 2^20, 2^30 and 2^40
Packit Service 336c1b
bytes respectively. The output is rounded to 3 or less significant
Packit Service 336c1b
figures in order to fit on a single line.
Packit Service 336c1b
It will also output the size of RBC devices, CD/DVD media and host
Packit Service 336c1b
managed ZBC disks. Host aware ZBC disks have their "peripheral device
Packit Service 336c1b
type" set to 0 (the same as normal disks) so their size is output.
Packit Service 336c1b
.br
Packit Service 336c1b
If given three times (short form is the more convenient: '\-sss') then
Packit Service 336c1b
the disk capacity as a logical block count is given. This is an exact
Packit Service 336c1b
figure in decimal reported by the storage device at discovery. Discovery
Packit Service 336c1b
is typically just after boot time, or when it was last attached if the
Packit Service 336c1b
storage device is removable.
Packit Service 336c1b
.br
Packit Service 336c1b
To unclutter the single line per device mode the \fI\-\-brief\fR option
Packit Service 336c1b
combined with this option should help.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-y\fR, \fB\-\-sysfsroot\fR=\fIPATH\fR
Packit Service 336c1b
assumes sysfs is mounted at PATH instead of the default '/sys' . If this
Packit Service 336c1b
option is given PATH should be an absolute path (i.e. start with '/').
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-S\fR, \fB\-\-sz\-lbs\fR
Packit Service 336c1b
Print disk capacity as a number of logical blocks (which is the same
Packit Service 336c1b
as '\-sss'). When used twice a comma is added followed by the logical
Packit Service 336c1b
block size in bytes. It should be a number like 512 or 4096.
Packit Service 336c1b
.br
Packit Service 336c1b
If the logical block size cannot be found (e.g. because the version of
Packit Service 336c1b
Linux predates the /sys/block/<dev_name>/queue directory) then the number
Packit Service 336c1b
of 512 byte blocks followed comma and then '512' is output irrespective of
Packit Service 336c1b
what the true logical block size of the device is. This special case
Packit Service 336c1b
action occurs whether this option is given one or more times.
Packit Service 336c1b
.br
Packit Service 336c1b
To unclutter the single line per device mode the \fI\-\-brief\fR option
Packit Service 336c1b
combined with this option should help.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-t\fR, \fB\-\-transport\fR
Packit Service 336c1b
Output transport information. This will be target related information or,
Packit Service 336c1b
if \fI\-\-hosts\fR is given, initiator related information. When used without
Packit Service 336c1b
\fI\-\-list\fR, a name or identifier (or both) are output on a single line,
Packit Service 336c1b
usually prefixed by the type of transport. For devices this information
Packit Service 336c1b
replaces the normal vendor, product and revision strings. When the
Packit Service 336c1b
\fI\-\-list\fR option is also given then additionally multiple lines
Packit Service 336c1b
of attribute_name=value pairs are output, each indented by two spaces. See
Packit Service 336c1b
the section on transports below.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-u\fR, \fB\-\-unit\fR
Packit Service 336c1b
Output logical unit name, if available. If this option is given once or
Packit Service 336c1b
twice, then the 30 character field where the vendor, product and revision
Packit Service 336c1b
strings are usually placed is expanded to 32 characters and replaced by the
Packit Service 336c1b
logical unit name. If no logical unit name is found "none" is printed.
Packit Service 336c1b
The first found of the NAA, EUI\-64 or SCSI name string is output unless a
Packit Service 336c1b
SCSI name string is found and the associated target port indicates the
Packit Service 336c1b
iSCSI protocol, in which case the SCSI name string is preferred. Finally
Packit Service 336c1b
if there is no match on the above and a T10 Vendor ID descriptor is found
Packit Service 336c1b
then it is used.
Packit Service 336c1b
.br
Packit Service 336c1b
If the name cannot fit in the 32 character field then it is truncated to
Packit Service 336c1b
the right and a trailing '_' character is used to alert the reader to the
Packit Service 336c1b
truncation. The 32 character width is chosen since that is large enough to
Packit Service 336c1b
hold 16 byte NAA or EUI\-64 identifiers. However SCSI name strings as used
Packit Service 336c1b
by iSCSI can be larger than that.
Packit Service 336c1b
.br
Packit Service 336c1b
If this option is used twice then this field is also 32 character wide. If
Packit Service 336c1b
the logical unit name cannot fit then it will be truncated to the left and
Packit Service 336c1b
a leading '_' character is used to alert the reader to the truncation.
Packit Service 336c1b
.br
Packit Service 336c1b
If this option is used three times the whole logical unit name is
Packit Service 336c1b
output, followed by several spaces.
Packit Service 336c1b
.br
Packit Service 336c1b
In order for this option to work, it needs a Linux kernel from and including
Packit Service 336c1b
3.15 . It accesses the sysfs vpd_pg83 file for the device in question. Old
Packit Service 336c1b
SCSI and ATA (SATA) equipment may not provide this information. If it is
Packit Service 336c1b
provided by ATA (SATA) then it will be the WWN.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-v\fR, \fB\-\-verbose\fR
Packit Service 336c1b
outputs directory names where information is found. Use multiple times for
Packit Service 336c1b
more output.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-V\fR, \fB\-\-version\fR
Packit Service 336c1b
outputs version information then exits. If used once outputs to stderr; if
Packit Service 336c1b
used twice outputs to stdout and shortens the date to yyyymmdd numeric
Packit Service 336c1b
format.
Packit Service 336c1b
.TP
Packit Service 336c1b
\fB\-w\fR, \fB\-\-wwn\fR
Packit Service 336c1b
outputs the WWN for disks instead of manufacturer, model and revision (or
Packit Service 336c1b
instead of transport information). The World Wide Name (WWN) is typically
Packit Service 336c1b
64 bits long (16 hex digits) but could be up to 128 bits long. To indicate
Packit Service 336c1b
the WWN is hexadecimal, it is prefixed by "0x". The ATA/SATA WWN is
Packit Service 336c1b
referred to as LU name in SCSI jargon; hence this option is more or less
Packit Service 336c1b
superseded by the \fI\-\-unit\fR and \fI\-\-long\-unit\fR options.
Packit Service 336c1b
.SH TRANSPORTS
Packit Service 336c1b
This utility lists SCSI devices which are known as logical units (LU) in
Packit Service 336c1b
the SCSI Architecture Model (ref: SAM\-5 at http://www.t10.org) or hosts
Packit Service 336c1b
when the \fI\-\-hosts\fR option is given. A host is called an initiator in
Packit Service 336c1b
SAM\-5. A SCSI command travels out via an initiator, across some transport
Packit Service 336c1b
to a target and then onwards to a logical unit. A target device may contain
Packit Service 336c1b
several logical units. A target device has one or more ports that can be
Packit Service 336c1b
viewed as transport end points. Each FC and SAS disk is a single target
Packit Service 336c1b
that has two ports and contains one logical unit. If both target ports
Packit Service 336c1b
on a FC or SAS disk are connected and visible to a machine, then lsscsi
Packit Service 336c1b
will show two entries. Initiators (i.e. hosts) also have one or more ports
Packit Service 336c1b
and some HBAs in Linux have a host entry per initiator port while others
Packit Service 336c1b
have a host entry per initiator device.
Packit Service 336c1b
.PP
Packit Service 336c1b
When the \fI\-\-transport\fR option is given for devices (i.e.
Packit Service 336c1b
\fI\-\-hosts\fR not given) then most of the information produced by lsscsi
Packit Service 336c1b
is associated with the target, or more precisely: the target port, through
Packit Service 336c1b
which SCSI commands pass that access a logical unit.
Packit Service 336c1b
.PP
Packit Service 336c1b
Typically this utility provides one line of output per "device" or host.
Packit Service 336c1b
Significantly more information can be obtained by adding the \fI\-\-list\fR
Packit Service 336c1b
option. When used together with the \fI\-\-transport\fR option, after
Packit Service 336c1b
the summary line, multiple lines of transport specific information in the
Packit Service 336c1b
form "<attribute_name>=<value>" are output, each indented by two spaces.
Packit Service 336c1b
Using a filter argument will reduce the volume of output if a lot of
Packit Service 336c1b
devices or hosts are present.
Packit Service 336c1b
.PP
Packit Service 336c1b
The transports that are currently recognized are: IEEE 1394, ATA, FC,
Packit Service 336c1b
iSCSI, SAS, SATA, SPI, SRP and USB.
Packit Service 336c1b
.PP
Packit Service 336c1b
For IEEE 1394 (a.k.a. Firewire and "SBP" when storage is involved), the
Packit Service 336c1b
EUI\-64 based target port name is output when \fI\-\-transport\fR is given,
Packit Service 336c1b
in the absence of the \fI\-\-hosts\fR option. When the \fI\-\-hosts\fR
Packit Service 336c1b
option is given then the EUI\-64 initiator port name is output. Output on
Packit Service 336c1b
the summary line specific to the IEEE 1394 transport is prefixed by "sbp:".
Packit Service 336c1b
.PP
Packit Service 336c1b
To detect ATA and SATA devices a crude check is performed on the driver
Packit Service 336c1b
name (after the checks for other transports are exhausted). Based on the
Packit Service 336c1b
driver name either the ATA or SATA transport type is chosen. Output on
Packit Service 336c1b
the summary line is either "ata:" or "sata:". A search is made for an
Packit Service 336c1b
associated vpd_pg83 file in sysfs, if found it may contain the device's
Packit Service 336c1b
WWN which is output if present. The WWN will not appear in Linux kernels
Packit Service 336c1b
before 3.15 and with old PATA and SATA devices. Most device and hosts
Packit Service 336c1b
flagged as "ata:" will use the parallel ATA transport (PATA). For SATA
Packit Service 336c1b
devices that are attached via a SAS expander, see the SAS paragraph below.
Packit Service 336c1b
.PP
Packit Service 336c1b
For Fibre Channel (FC) the port name and port identifier are output
Packit Service 336c1b
when \fI\-\-transport\fR is given. In the absence of the \fI\-\-hosts\fR
Packit Service 336c1b
option these ids will be for the target port associated with the
Packit Service 336c1b
device (logical unit) being listed. When the \fI\-\-hosts\fR option is
Packit Service 336c1b
given then the ids are for the initiator port used by the host. Output
Packit Service 336c1b
on the summary line specific to the FC transport is prefixed by "fc:".
Packit Service 336c1b
If FCoE (over Ethernet) is detected the prefix is changed to "fcoe:".
Packit Service 336c1b
.PP
Packit Service 336c1b
For iSCSI the target port name is output when \fI\-\-transport\fR is given,
Packit Service 336c1b
in the absence of the \fI\-\-hosts\fR option. This is made up of the
Packit Service 336c1b
iSCSI name and the target portal group tag. Since the iSCSI name starts
Packit Service 336c1b
with "iqn" no further prefix is used. When the \fI\-\-hosts\fR option
Packit Service 336c1b
is given then only "iscsi:" is output on the summary line.
Packit Service 336c1b
.PP
Packit Service 336c1b
For Serial Attached SCSI the SAS address of the target port (or initiator
Packit Service 336c1b
port if \fI\-\-hosts\fR option is also given) is output. This will be a naa\-5
Packit Service 336c1b
address. For SAS HBAs and SAS targets (such as SAS disks and tape drives)
Packit Service 336c1b
the SAS address will be world wide unique. For SATA disks attached to a
Packit Service 336c1b
SAS expander, the expander provides the SAS address by adding a non zero
Packit Service 336c1b
value to its (i.e. the expander's) SAS address (e.g. expander_sas_address +
Packit Service 336c1b
phy_id + 1). SATA disks directly attached to SAS HBAs seem to have an
Packit Service 336c1b
indeterminate SAS address. Output on the summary line specific to the SAS
Packit Service 336c1b
transport is prefixed by "sas:".
Packit Service 336c1b
.PP
Packit Service 336c1b
For SATA devices, see the paragraph above on ATA devices. As noted in the
Packit Service 336c1b
previous paragraph, SATA devices attached to SAS expanders will display a
Packit Service 336c1b
manufactured SAS transport address (manufactured by the expander) rather
Packit Service 336c1b
than the SATA device's WWN.
Packit Service 336c1b
.PP
Packit Service 336c1b
For the SCSI Parallel Interface (SPI) the target port identifier (usually
Packit Service 336c1b
a number between 0 and 15 inclusive) is output when \fI\-\-transport\fR is
Packit Service 336c1b
given, in the absence of the \fI\-\-hosts\fR option. When the \fI\-\-hosts\fR
Packit Service 336c1b
option is given then only "spi:" is output on the summary line.
Packit Service 336c1b
.PP
Packit Service 336c1b
For the PCIe transport (a.k.a. PCI Express) there at two possible storage
Packit Service 336c1b
types: NVMe and SOP/PQI (SCSI over PCIe). There are very few examples of the
Packit Service 336c1b
latter currently so this utility concentrates on NVMe. NVMe uses its own
Packit Service 336c1b
command set and not SCSI but has many things in common. Rather than
Packit Service 336c1b
re\-invent everything currently in use that SCSI has accumulated over nearly
Packit Service 336c1b
40 years, NVMe is beginning to use some parts of SCSI. A recent example is
Packit Service 336c1b
the SES\-3 standard for enclosure management which has been adopted by NVMe.
Packit Service 336c1b
In SCSI a SES device is a logical unit with a peripheral device type (PDT)
Packit Service 336c1b
of 0xd (for enclosure) so it will appear when the lsscsi utility is invoked
Packit Service 336c1b
without any options. In NVMe is seems that an enclosure with appear as
Packit Service 336c1b
attached to the management interface (MI) of a NVMe controller. This means
Packit Service 336c1b
it should appear when "lsscsi \-\-hosts" is invoked. It is unclear whether
Packit Service 336c1b
such a NVMe controller can have any storage namespaces associated with
Packit Service 336c1b
it. The sg_ses utility (in the sg3_utils package) can then be given that NVMe
Packit Service 336c1b
controller's device name (e.g. /dev/nmve1).
Packit Service 336c1b
.br
Packit Service 336c1b
When the \fI\-\-transport\fR option is given, after "pcie" the NVMe
Packit Service 336c1b
controller's subsystem vendor id and device id are output, separated by a
Packit Service 336c1b
colon (e.g. "pcie 0x8086:0x390a").
Packit Service 336c1b
.PP
Packit Service 336c1b
For the SCSI RDMA Protocol (SRP) the IB (InfiniBand) port's GUID is given.
Packit Service 336c1b
As an example, it has a form like this: 0002:c903:00fa:abcd .
Packit Service 336c1b
.PP
Packit Service 336c1b
When a USB transport is detected, the summary line will contain "usb:"
Packit Service 336c1b
followed by a USB device name. The USB device name has the
Packit Service 336c1b
form "\-<p1>[.<p2>[.<p3>]]:<c>." where  is the USB bus number, <p1>
Packit Service 336c1b
is the port on the host. <p2> is a port on a host connected hub, if present.
Packit Service 336c1b
If needed <p3> is a USB hub port closer to the USB storage device. <c>
Packit Service 336c1b
refers to the configuration number while  is the interface number. There
Packit Service 336c1b
is a separate SCSI host for each USB (SCSI) target. A USB SCSI target may
Packit Service 336c1b
contain multiple logical units. Thus the same "usb: <device_name>" string
Packit Service 336c1b
appears for a USB SCSI host and all logical units that belong to the USB
Packit Service 336c1b
SCSI target associated with that USB SCSI host.
Packit Service 336c1b
.SH LUNS
Packit Service 336c1b
For historical reasons and as used by several other Unix based Operating
Packit Service 336c1b
Systems, Linux uses a tuple of integers to describe (a path to) a SCSI
Packit Service 336c1b
device (also know as a Logical Unit (LU)). The last element of that tuple
Packit Service 336c1b
is the so\-called Logical Unit Number (LUN). And originally in SCSI a
Packit Service 336c1b
LUN was an integer, at first 3 bits long, then 8 then 16 bits. SCSI LUNs
Packit Service 336c1b
today (SAM\-5 section 4.7) are 64 bits but SCSI standards now consider
Packit Service 336c1b
a LUN to be an array of 8 bytes.
Packit Service 336c1b
.PP
Packit Service 336c1b
Up until 2013, Linux mapped SCSI LUNs to a 32 bit integer by taking the
Packit Service 336c1b
first 4 bytes of the SCSI LUN and ignoring the last 4 bytes. Linux treated
Packit Service 336c1b
the first two bytes of the SCSI LUN as a unit (a word) and it became the
Packit Service 336c1b
least significant 16 bits in the Linux LUN integer. The next two bytes of
Packit Service 336c1b
the SCSI LUN became the upper 16 bits in the Linux LUN integer. The rationale
Packit Service 336c1b
for this was to keep commonly used LUNs small Linux LUN integers. The most
Packit Service 336c1b
common LUN (by far) in SCSI LUN (hex) notation is 00 00 00 00 00 00 00 00
Packit Service 336c1b
and this becomes the Linux LUN integer 0. The next most common LUN is
Packit Service 336c1b
00 01 00 00 00 00 00 00 and this becomes the Linux LUN integer 1.
Packit Service 336c1b
.PP
Packit Service 336c1b
In 2013 it is proposed to increase Linux LUNs to a 64 bit integer by extending
Packit Service 336c1b
the mapping outlined above. In this case all information that is possible
Packit Service 336c1b
to represent in a SCSI LUN is mapped a Linux LUN (64 bit) integer. And the
Packit Service 336c1b
mapping can be reversed without losing information.
Packit Service 336c1b
.PP
Packit Service 336c1b
This version of the utility supports both 32 and 64 bit Linux LUN integers.
Packit Service 336c1b
By default the LUN shown at the end of the tuple commencing each line is
Packit Service 336c1b
a Linux LUN as a decimal integer. When the \fI\-\-lunhex\fR option is given
Packit Service 336c1b
then the LUN is in SCSI LUN format with the 8 bytes run together, with the
Packit Service 336c1b
output in hexadecimal and prefixed by '0x'. The LUN is decoded according
Packit Service 336c1b
to SAM\-5's description and trailing zeros (i.e. digits to the right) are not
Packit Service 336c1b
shown. So LUN 0 (i.e. 00 00 00 00 00 00 00 00) is shown as 0x0000 and
Packit Service 336c1b
LUN 65 (i.e. 00 41 00 00 00 00 00 00) is shown as 0x0041.
Packit Service 336c1b
If the \fI\-\-lunhex\fR option is given twice then the full 64 bits (i.e. 16
Packit Service 336c1b
hexadecimal digits) are shown.
Packit Service 336c1b
.PP
Packit Service 336c1b
If the \fI\-\-lunhex\fR option is not given on the command line then the
Packit Service 336c1b
environment variable LSSCSI_LUNHEX_OPT is checked. If LSSCSI_LUNHEX_OPT is
Packit Service 336c1b
present then its associated value becomes the number of times the
Packit Service 336c1b
\fI\-\-lunhex\fR is set internally. So, for
Packit Service 336c1b
example, 'LSSCSI_LUNHEX_OPT=2  lsscsi' and 'lsscsi \-xx' are equivalent.
Packit Service 336c1b
.SH ORDER OF SCSI IDENTIFIERS
Packit Service 336c1b
This section only applies to the \fI\-\-scsi_id\fR option and only for
Packit Service 336c1b
disk like devices (e.g. not tapes nor enclosures). There are potentially
Packit Service 336c1b
several SCSI identifiers and from revision 164 they are checked in the
Packit Service 336c1b
following order and only the first found is output.
Packit Service 336c1b
.PP
Packit Service 336c1b
The SCSI identifier preference order is:
Packit Service 336c1b
.br
Packit Service 336c1b
  \fB3\fR : NAA based (Network address Authority)
Packit Service 336c1b
.br
Packit Service 336c1b
  \fB2\fR : EUI-64 based
Packit Service 336c1b
.br
Packit Service 336c1b
  \fB8\fR : SCSI name string (e.g. iSCSI: iqn.1998-01.com.zzware.iscsi:name1)
Packit Service 336c1b
.br
Packit Service 336c1b
  \fBS\fR : serial number from SCSI VPD page 0x80
Packit Service 336c1b
.br
Packit Service 336c1b
  \fB1\fR : T10 Vendor Identifier
Packit Service 336c1b
.br
Packit Service 336c1b
  \fB0\fR : Vendor Specific
Packit Service 336c1b
.br
Packit Service 336c1b
Those numbers prefixing each entry are the SCSI 'Designator Types' found
Packit Service 336c1b
in the definition of the Device Identification VPD page (0x83) in SPC/-3,
Packit Service 336c1b
SPC/-4 and SPC/-5. The 'S' of course if not a number and it refers to
Packit Service 336c1b
a different VPD page: the Serial Number VPD page (0x80).
Packit Service 336c1b
.PP
Packit Service 336c1b
There is a more general \fI\-\-wwn\fR option that should apply to almost all
Packit Service 336c1b
devices. The term "WWN" (world\-wide name) comes from the ATA and NVMe
Packit Service 336c1b
standards and corresponds to the "Logical Unit (LU) name" in SCSI. The LU
Packit Service 336c1b
name in SCSI tends to change by transport. For SAS the LU name is the LU's
Packit Service 336c1b
NAA identifier.
Packit Service 336c1b
.PP
Packit Service 336c1b
Plus there the \fI\-\-unit\fR and the \fI\-\-long\-unit\fR options that may
Packit Service 336c1b
be helpful in uniquely identifying storage devices.
Packit Service 336c1b
.SH EXAMPLES
Packit Service 336c1b
Information about this utility including examples can also be found at:
Packit Service 336c1b
http://sg.danny.cz/scsi/lsscsi.html .
Packit Service 336c1b
.SH NOTES
Packit Service 336c1b
Information for this command is derived from the sysfs file system,
Packit Service 336c1b
which is assumed to be mounted at /sys unless specified otherwise
Packit Service 336c1b
by the user.
Packit Service 336c1b
SCSI (pseudo) devices that have been detected by the SCSI mid level
Packit Service 336c1b
will be listed even if the required upper level drivers (i.e. sd, sr,
Packit Service 336c1b
st, osst or ch) have not been loaded. If the appropriate upper level
Packit Service 336c1b
driver has not been loaded then the device file name will appear
Packit Service 336c1b
as '\-' rather than something like '/dev/st0'. Note that some
Packit Service 336c1b
devices (e.g. scanners and medium changers) do not have a primary upper
Packit Service 336c1b
level driver and can only be accessed via a SCSI generic (sg) device
Packit Service 336c1b
name.
Packit Service 336c1b
.PP
Packit Service 336c1b
Generic SCSI devices can also be accessed via the bsg driver in Linux.
Packit Service 336c1b
By default, the bsg driver's device node names are of the
Packit Service 336c1b
form '/dev/bsg/\fIH:C:T:L\fR'. So, for example, the SCSI device shown by this
Packit Service 336c1b
utility on a line starting with the tuple '6:0:1:2' could be accessed via the
Packit Service 336c1b
bsg driver with the '/dev/bsg/6:0:1:2' device node name.
Packit Service 336c1b
.PP
Packit Service 336c1b
lsscsi version 0.21 or later is required to correctly display SCSI devices
Packit Service 336c1b
in Linux kernel 2.6.26 (and possibly later) when the
Packit Service 336c1b
CONFIG_SYSFS_DEPRECATED_V2 kernel option is not defined.
Packit Service 336c1b
.SH AUTHOR
Packit Service 336c1b
Written by Doug Gilbert
Packit Service 336c1b
.SH "REPORTING BUGS"
Packit Service 336c1b
Report bugs to <dgilbert at interlog dot com>.
Packit Service 336c1b
.SH COPYRIGHT
Packit Service 336c1b
Copyright \(co 2003\-2020 Douglas Gilbert
Packit Service 336c1b
.br
Packit Service 336c1b
This software is distributed under the GPL version 2. There is NO
Packit Service 336c1b
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit Service 336c1b
.SH "SEE ALSO"
Packit Service 336c1b
.B lspci
Packit Service 336c1b
.B lsusb
Packit Service 336c1b
.B lsblk