Master lsscsi: Understand SCSI, Storage Interfaces, and Linux Commands
This guide explains the SCSI protocol, compares common hard‑disk interfaces such as IDE, SCSI, and SATA, shows how to install and use the lsscsi command with its options and examples, and details Linux SCSI file nodes and logging configuration.
What is SCSI?
SCSI (Small Computer System Interface) is a complete data‑transfer protocol that enables hosts to communicate with storage devices, transmitting commands, status, and block data. It sits between the operating system and external resources, and its functionality is typically embedded in device drivers or host adapters.
Common Hard‑Disk Interfaces
1. IDE Interface
IDE (Integrated Drive Electronics) integrates the drive controller with the disk, originally referring to ATA‑1 drives. It is inexpensive, highly compatible, but offers slower data transfer and no hot‑plug support.
2. SCSI Interface
SCSI is a high‑speed data‑transfer technology used mainly in servers and workstations. It supports multiple devices, hot‑plug, and offers high bandwidth, though at a higher cost.
3. SATA Interface
SATA (Serial Advanced Technology Attachment) uses serial communication with embedded clock signals, providing stronger error correction, hot‑plug capability, and is the prevailing interface for modern PCs.
lsscsi Command
lsscsi lists SCSI/SATA devices such as hard‑disk and optical drives.
Installation
# Debian/Ubuntu/Kali
apt-get install lsscsi
# Alpine
apk add lsscsi
# Arch Linux
pacman -S lsscsi
# CentOS
yum install lsscsi
# Fedora
dnf install lsscsi
# Docker
docker run cmd.cat/lsscsi lsscsiManual Page
Detailed command documentation is available at:
https://sg.danny.cz/scsi/lsscsi.htmlSyntax
lsscsi [options] [H:C:T:L]Options
-g: Show generic SCSI device file name
-k: Show kernel name instead of device node name
-d: Show major and minor numbers of the device node
-H: List SCSI hosts rather than devices
-l: Show additional information for each SCSI device
-c: Output similar to cat /proc/scsi/scsi -p: Show data integrity (protection) information
-t: Show transport information (ATA, FC, SBP, iSCSI, SPI, SAS, SATA, USB)
-L: Display additional attributes as "name=value" pairs
-v: Output directory name when information is found
-y<path>: Assume sysfs is mounted at the specified path
-s: Show human‑readable capacity size
-x: Display LUN number in hexadecimal
-P: Show valid protection mode information
-i: Show udev‑related properties
-w: Show WWN (World Wide Name)
Result Meaning
Examples
List all SCSI devices:
peng@ubuntu:~$ lsscsi
[3:0:0:0] cd/dvd NECVMWar VMware SATA CD01 1.00 /dev/sr0
[32:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sdaShow detailed attributes:
peng@ubuntu:~$ lsscsi -L
[3:0:0:0] cd/dvd NECVMWar VMware SATA CD01 1.00 /dev/sr0
device_blocked=0
iocounterbits=32
...
[32:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
device_blocked=0
iocounterbits=32
...Show human‑readable capacity:
peng@ubuntu:~$ lsscsi -s
[3:0:0:0] cd/dvd NECVMWar VMware SATA CD01 1.00 /dev/sr0 -
[32:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda 536GBLinux SCSI File Nodes
Key directories and example commands:
# /proc/scsi/
cd /proc/scsi/
ls
# Output shows device_info, mptspi, scsi, sg
cat scsi
# Sample output:
Attached devices:
Host: scsi32 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi3 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware SATA CD01 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05Other useful paths:
/sys/class/scsi_host – list of SCSI host adapters
/sys/class/scsi_device – device identifiers (e.g., 3:0:0:0)
/sys/class/scsi_disk – disk devices
/sys/class/scsi_generic – generic SCSI devices (sg0, sg1)
/sys/bus/scsi – drivers and devices hierarchy
Enabling SCSI Logging
Compile the kernel with CONFIG_SCSI_LOGGING enabled.
Set the desired logging level via /proc/sys/dev/scsi/logging_level. The level is a 32‑bit bitmask where each 3‑bit field represents a logging category.
Typical values: -1 to enable all SCSI events to syslog, 0 to disable.
Example command to disable logging: echo 0 > /proc/sys/dev/scsi/logging_level Example command to enable all logging:
echo -1 > /proc/sys/dev/scsi/logging_levelSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
