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

One thought on “How to find storage devices attached to computer”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s