To list the SCSI devices on your system, use a utility that walks the device paths provided by sysfs. One of the most succinct tools is lsscsi. Here’s what you can expect when you run it:
$ lsscsi [0:0:0:0] disk ATA WDC WD3200AAJS-2 01.0 /dev/sda [2:0:0:0] disk FLASH Drive UT_USB20 0.00 /dev/sdb
The first column identifies the address of the device on the system, the second describes what kind of device it is, and the last indicates where to find the device file. Everything else is vendor information.
Use yum -y install lsscsi to install the lsscsi package, and enter lsscsi to verify that installation was successful:
# yum -y install lsscsi # lsscsi
If you encounter the below error while running the command lsscsi:
lsscsi: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install lsscsi |
Ubuntu | apt-get install lsscsi |
Alpine | apk add lsscsi |
Arch Linux | pacman -S lsscsi |
Kali Linux | apt-get install lsscsi |
CentOS | yum install lsscsi |
Fedora | dnf install lsscsi |
Raspbian | apt-get install lsscsi |
lsscsi Command Examples
1. To list SCSi devices:
# lsscsi
2. To get the classic output:
# lsscsi -c # lsscsi --classic
3. To get the device name the device node major and minor numbers:
# lsscsi -d # lsscsi --device
4. To output the scsi generic device file name:
# lsscsi -g # lsscsi --generic
5. To get the help:
# lsscsi -h # lsscsi --help
6. To list the SCSI hosts currently attached to the system.
# lsscsi -H # lsscsi --hosts
7. To Use linux default algorithm for naming devices:
# lsscsi -k # lsscsi --kname
8. To output additional information in pairs:
# lscsci -L # lscsci --list
9. To output additional information for each SCSI device:
# lsscsi -l # lsscsi --long
10. To output additional data integrity (protection) information:
# lsscsi -p # lsscsi --protection
11. To output transport information:
# lsscsi -t # lsscsi --transport
12. To get the verbose info:
# lsscsi -v # lsscsi --verbose
13. To get the version:
# lsscsi -V # lsscsi --version
14. To assumes sysfs is mounted at PATH instead of the default /sys:
# lsscsi -y # lsscsi --sysfsroot=PATH