How to find if disk is SSD or HDD

Disk IO can be the bottleneck for certain programs. When I work with such programs on remote servers, I prefer to place their data or direct their output to SSD instead of HDD. I can view the available partitions and their filesystems using the df command. But, how to find out which of the mounted partitions is on a SSD and which on HDD?

You probably know that the disk of a partition listed as /dev/sdb7 is /dev/sdb. That is, by removing the numerical suffix from the partition, you get the disk.

To find out if the disk is SSD or HDD, check the /sys pseudo filesystem using the disk name:

$ cat /sys/block/sdb/queue/rotational

If it is HDD, and thus a rotational disk, the value will be 1. For SSD, the value will be 0.

Tried with: Ubuntu 14.04

Leave a Reply

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

You are commenting using your 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