How to find storage devices attached to computer

Two storage devices found attached to computer
Two storage devices found attached to computer

Storage devices like hard disks, SSD drives, CD/DVD disks, SD cards and USB thumdrives can be plugged into a Linux computer. For many operations, we need to know the name of the storage device. For example, /dev/sda. Partitions created on this device to store data will have characters suffixed to this device name. For example, /dev/sda7 might be a partition on the /dev/sda hard disk.

Using fdisk

I like to find out the device name of storage devices by listing them out using fdisk:

$ sudo fdisk -l

For each storage device, this lists the device name (named after Disk) followed by information about it and its partitions.

Using df

The df command lists the mounted partitions on the computer:

$ df -h

You will have to guess the name of the storage device from the partition name by removing a few characters of suffix. For example, partitions on a SD card named /dev/mmcblk0 might be named as /dev/mmcblk0p1 and /dev/mmcblk0p2.

Using GNOME Disk

The GNOME Disk utility is typically pre-installed on Ubuntu. It can be invoked from the Dash using its name Disks or from the shell as gnome-disks. It shows all the attached storage devices and their name is listed under Device.

Using lshw

Some people suggest listing the disk class of devices from the lshw command:

$ sudo lshw -class disk

I do not prefer this since it does not list SD cards and many such storage devices.

Tried with: Ubuntu 14.04


lshw is a neat little command to list out the details of your computer hardware. The text display is in the form a tree, like in the Device Manager on Windows. Remember to run this program with superuser privileges, else the displayed information will not be complete nor correct!

$ sudo lshw

To get a nice little table of all the devices on your computer:

$ sudo lshw -short

To see the details of a particular class of devices, memory for example:

$ sudo lshw -short -C memory

If you would prefer a GUI to explore the hardware hierarchy, then install the GTK program of lshw and try it:

$ sudo apt install lshw-gtk
$ sudo lshw -X

Click the Refresh button to begin the scan of your computer.

Tried with: Lshw B.02.16 and Ubuntu 14.04