Hardware

Another Way To View Attached Storage Devices

Linux offers myriad ways to accomplish the same task, which is a good thing, and this is another way to view attached storage devices. This is a useful way to learn more about your storage devices and is a bit more advanced than others.

There are many ways to view attached storage devices. While not the same, you can learn which storage devices are attached to your system with any of the following articles:

Show Your Filesystem In The Linux Terminal
Show Mounted Partitions
How To: List Mounted Partitions
Yet Another Way To Check Filesystem Space Use

Stuff like that…

Well, you can also just plain old view attached storage devices in the Linux terminal. The application I’ll be showing you will do more than this, but we’ll concentrate on just showing attached storage devices.

The tool we’ll be using is known as:

lsscsi:

Yes, we’ll be making use of the lsscsi application for this article. This won’t take very long and you should find that lsscsi is available for pretty much every operating system out there. It does what you’d think, list SCSI devices.

Once installed, you could check the man page to see that this is the correct tool if your goal is to view attached storage devices. The man page describes the lsscsi application like this:

lsscsi – list SCSI devices (or hosts), list NVMe devices

It’s a simple application, at least for our needs. You’ll find that you can get some of the same information with the following command:

cat /proc/scsi/scsi

However, that command won’t give you things like the path. Mounted storage devices tend to have a path of something like /dev/<path>, and that information isn’t available with the cat command listed above. As we often want to know the path information, and there are many tools to do this, you might as well learn about lsscsi. 

By the way, your GUI disk manager (such as gnome-disks) will happily give you some of this information. It’s also a graphical environment, which may be easier for some folks. This is for those needing that information while using the terminal, or for those who are just interested in doing more in the terminal.

But, when it comes to disk and data management, you may need to know this information – especially the paths. So, this is a good command to have in your pocket. You never know when it will come in handy.

View Attached Storage Devices:

If you’re unfamiliar with the lsscsi application, it’s a terminal-based application. If you’re already familiar with the lsscsi application, I’m not sure why you’re still reading the article! Either way now is the time when you open a terminal. Oftentimes, you can open a terminal by just using your keyboard. Try pressing CTRL + ALT + T and your default terminal should open.

With your terminal now open, it’s time to install lsscsi. The directions to do so will depend on your package manager, but I’m going to cover most of them because this application is widely available and packaged for almost anything you can think of.

Installing lsscsi:

With your terminal open, use the correct command for your package manager:

Debian/Ubuntu/etc:

sudo apt install lsscsi

RHEL/CentOS/etc:

sudo dnf install lsscsi

Gentoo:

emerge sys-apps/lsscsi

OpenSUSE/SUSE/etc:

sudo zypper install lsscsi

Arch/Manjaro/etc:

pacman -S lsscsi

One of those should work for most of you. If not, let me know in the comments and I’ll amend the application. If they’re wrong, please do let me know in the comments. I did not test all of these. I’m going with a combination of my notes and what I’m able to scrape from the internet.

Using lsscsi:

With that open terminal, just enter the name of the command and you have about all the use you’ll really need from the application. The command is simply:

lsscsi

If you want, there’s more to the application – which you might need for some advanced operations. You can just check the man page with this command:

man lsscsi

Here’s an example output:

$  lsscsi
[0:0:0:0]    disk    ATA      TEAM T253X2512G  7B0   /dev/sda 
[1:0:0:0]    cd/dvd  PLDS     DVD+-RW DU-8A5LH 6D1M  /dev/sr0 
[4:0:0:0]    disk    WD       Elements 25A3    1030  /dev/sdb 
[5:0:0:0]    disk    Imation  2 in 1 Micro     PMAP  /dev/sdc 

Here’s another example output:

$  lsscsi
[N:0:1:1]    disk    KINGSTON OM8PCP3512F-AI1__1                /dev/nvme0n1

If you look at the bottom one, there’s a bit of an Easter Egg. You’ll see that it starts with an N and that means it’s an NVMe device. You don’t need any special tools beyond lsscsi to view NVMe devices, which is nice. The program happily recognizes it and other attached storage devices.

Closure:

You never know when you’re going to want to view attached storage devices. However, the odds are good that you’ll eventually want to know this information. It’s always good to verify the path of a dd command, for example. A malformed command can really cause you some problems.

So, now you know how to view attached storage devices – a task that has many solutions in Linux. There’s nothing wrong with variety and each of the various tools will have different strengths. Knowing what to use and when to use it is something you’ll learn as you make progress.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Enable/Disable Your Network Interface

Today we'll cover one way to enable or disable your network interface in the Linux…

5 months ago

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

5 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

6 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

6 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

6 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

6 months ago