Yes, we're now running our only Summer Sale. All Courses are 30% off until 20th July, 2026:
Finding SCSI Device IDs in Linux
Last updated: February 21, 2025
1. Overview
Small Computer System Interface (SCSI) is a standard that allows a computer to communicate with physical devices like hard disk drives.
Often, we have multiple drives connected to a single SCSI bus. To differentiate these devices, the Linux kernel assigns SCSI Identifications (IDs) to each.
In this tutorial, we’ll learn how to find SCSI device IDs using Linux commands.
First, we’ll see how the kernel defines SCSI devices. Then, we’ll look at how to find the device IDs in the /sys directory. Finally, we’ll learn the command to get a list with all SCSI device IDs.
2. How SCSI Devices Are Named
Once we plug a SCSI device into the PC, the kernel provides an ID to be able to recognize it later.
The SCSI ID consists of four numbers separated by columns. For example, this is an SCSI ID:
2:0:0:0
Here, the first element is the host number, the second element is the controller number, the third one is the target number, and the final element is the logical unit number.
Now, let’s learn the commands to get the SCSI IDs.
3. Find SCSI Devices in /sys
We can list all SCSI device IDs in the /sys/bus/scsi/devices directory using the ls command:
$ ls /sys/bus/scsi/devices
0:0:0:0 2:0:0:0
As can be seen, there are two SCSI devices with the IDs 0:0:0:0 and 2:0:0:0.
4. Using lsscsi Command
Another way of getting the device IDs is by using the lsscsi command.
We may need to install it using the apt command if it’s not already present in our system:
$ sudo apt install lsscsi
Once installed, we can get the list of connected SCSI devices. For that, we use the –scsi_id option:
$ lsscsi --scsi_id
[0:0:0:0] disk ATA KINGSTON SM2280S 01.W /dev/sda -
[2:0:0:0] disk ATA TOSHIBA DT01ACA1 A750 /dev/sdb -
Let’s look at the output in more detail:
- The first column represents the SCSI device ID sequence
- The disk is the device type
- ATA is the controller type
- Then, the disk name is shown
- The final column shows the connected partition
As we can see, the output shows information about two connected SCSI devices with their device IDs.
5. Conclusion
In this article, we learned how to find SCSI device IDs.
First, we looked at how the SCSI ID is defined. Then, we use the /sys directory to find the device IDs. Finally, we learned the lsscspi command to get the list of SCSI devices.