LinuxCommandLibrary

lsscsi

List SCSI devices (or hosts) and attributes

TLDR

List all SCSI devices

$ lsscsi
copy

List all SCSI devices with detailed attributes
$ lsscsi [[-L|--list]]
copy

List all SCSI devices with human-readable disk capacity
$ lsscsi [[-s|--size]]
copy

SYNOPSIS

lsscsi []

PARAMETERS

-a
    Show all available information, including device handles.

-b
    Show bus:target:lun in place of device file.

-c []
    Column separator; defaults to single space. num gives the number of spaces.

-d
    Show device node (e.g. /dev/sda) when available.

-D
    Show the device directory

-g
    Show the sg device name (e.g. /dev/sg0).

-H
    Limit to listed host adapters (e.g. 0,2).

-i
    Show the iqn address if the device has one.

-I
    Show the initiator name

-l
    Show more details (like WWN).

-n
    Show device node major and minor numbers.

-p
    Show peripheral device type (e.g., disk, tape).

-P
    Show device sysfs path.

-r
    Show the SCSI Revision descriptor

-s
    Show the size of the device

-t
    Show the transport type

-T []
    Only list given transport type. Use '-T help' for all available transport types.

-w
    Show the WWN (World Wide Name).

-v
    Be verbose.

-V
    Show version information and exit.

-?
    Display usage information and exit.

DESCRIPTION

The `lsscsi` command is a utility used to list SCSI (Small Computer System Interface) devices, including SAS (Serial Attached SCSI) and Fibre Channel devices, that are attached to a Linux system. It interrogates the /proc file system and sysfs to gather information about the SCSI devices and then presents the information in a human-readable format. It shows the SCSI bus, the host adapter, the channel, target, and LUN (Logical Unit Number) of each device. It helps identify devices like hard drives, tape drives, CD-ROM drives, and other peripherals. The command is valuable for diagnosing storage connectivity issues, verifying proper device recognition, and obtaining device identifiers for configuration purposes. It is crucial for system administrators and developers who work with storage technologies and need to understand the device layout and addressing on the system. The output typically includes vendor, product, and revision information. Its flexibility in filtering allows users to pinpoint particular device types or buses.

CAVEATS

Output can be misleading if device nodes are not configured correctly. Requires appropriate permissions to access /proc and sysfs.

EXIT STATUS

Returns 0 if successful, or 1 if an error occurred.
Exit code of 95 indicates that the command is not supported on the current platform.

DEVICE IDENTIFICATION

Uses information from /proc/scsi/scsi and sysfs to get device details.
Ensure these file systems are mounted.

HISTORY

lsscsi was initially developed by Douglas Gilbert and is actively maintained. The command arose from the need to easily list and identify SCSI devices in Linux systems, especially as SCSI and related technologies like SAS and Fibre Channel became more prevalent. Its development focuses on enhancing the ease of use, increasing the accuracy of device identification, and keeping up-to-date with evolving SCSI standards and kernel interfaces. Over time, features such as filtering by host adapter and displaying WWNs have been added, increasing its utility for system administrators and storage engineers.

SEE ALSO

sg_scan(8), sdparm(8), lspci(8), lsusb(8)

Copied to clipboard