How to find a Disk is SSD or HDD in Linux?

Updated on December 20, 2019

I recently bought a server with SSD (Solid State Drive) disk. But how do I verify if I had really got a server with SSD disk? Fortunately there are few commands that will tell you if a disk attached to system is SSD or HDD. So if you ever want to know whether a disk is SSD or HDD, then here’s how you can find that out.

Before we learn about commands, let’s understand the difference between SSD and HDD.

Difference between HDD and SSD

Traditionally hard drives are spinning device that are non-volatile storage, which means the data is not lost when the power is turned off. Hard drive is a metal platter that is covered with a magnetic coating to store data. You need a data? The read/write head on an arm accesses the data while metal platter is spinning.  The faster the platter spins, faster the HDD performs.

But SSD (Solid State Drives) stores data on an interconnected flash memory chips and does not lose data when the power is turned off. Flash memory chips are faster and more reliable. It means, SSD disk does not spin. Read more about SSD vs HDD here.

So HDD rotates and SSD does not. Tell again, HDD rotates and SSD does not. Now let’s learn commands that will allow you to identify if a particular disk is SSD or HDD.

How to check if Disk is SSD or HDD

Method 1: Check if the disk is rotational

Since kernel version 2.6.29, Linux systems can automatically detect SSD. So executing the below command will tell you if a disk is SSD or HDD.

# cat /sys/block/sda/queue/rotational
0

If the above output is 0 (zero), then the disk is SSD (because SSD does not rotate). You should see output '1' on machines that has HDD disk.

Method 2: Using lsblk command

You can also check if the disk is rotational or not using lsblk command.

Use yum to check which package provides lsblk command.

# yum provides lsblk

Sample output:

util-linux-2.23.2-43.el7.i686 : A collection of basic system utilities
Repo : base
Matched from:
Filename : /usr/bin/lsblk

The above output confirms that util-linux is the package that distributes lsblk command.

Install lsblk

# yum install util-linux

Now check if the disk is rotational or not using the below command.

$ lsblk -d -o name,rota
NAME ROTA
sda 0

If the output of the above command is '0' for ROTA, then the disk is SSD. In case of output being '1', the disk is HDD.

Method 3: Using SMART monitoring tools

Smart monitoring tools is a control and monitoring utility for SATA, SCSI hard drives and solid state drive. The tool comes with a command called 'smartctl'.

Use yum to check which package provides smartctl command.

# yum provides smartctl

Sample output:

1:smartmontools-6.2-8.el7.x86_64 : Tools for monitoring SMART capable hard disks
Repo : base
Matched from:
Filename : /usr/sbin/smartctl

The above output suggests that smartmontools is the package that distributes smartctl command.

Install smartmontools 

# yum install smartmontools

Use smartctl command as shown below:

# smartctl -a /dev/sda

Sample output:

:::::::::::::::::::::::::::::::::::::::::
=== START OF INFORMATION SECTION ===
Model Family: Marvell based SanDisk SSDs
Device Model: SanDisk Ultra II 480GB
Serial Number: 154518447336
LU WWN Device Id: 5 001b44 f059960e8
Firmware Version: X41100RL
User Capacity: 480,103,981,056 bytes [480 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-2 T13/2015-D revision 3
SATA Version is: SATA >3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Thu Nov 9 09:21:31 2017 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
::::::::::::::::::::::::::::::::::::::::::::::::

Lookout for 'Rotation Rate' in the above output.

Method 4: Dig through dmesg

You can quickly dig through dmesg to read the model of the disk.

$ dmesg | grep -i -e scsi -e ata

Sample output:

::::::::::::::::::::::::::::::
[ 1.312577] ata1.00: configured for UDMA/133
[ 1.312822] scsi 0:0:0:0: Direct-Access ATA SanDisk Ultra II 00RL PQ: 0 ANSI: 5
:::::::::::::::::::::::::::::::::::

In the above output, lookout for the model and just Google it to know if the disk is HDD or SSD.

Method 5: Read SCSI inside proc file system

You can find the disk model information using the below command:

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 01 Id: 00 Lun: 00
 Vendor: WDC Model: WD5002ABYS-0 Rev: 02.0
 Type: Direct-Access ANSI SCSI revision: 05

Now Google the model to know if the disk is HDD or SSD.

Note:

I have used /dev/sda for demonstration purpose. You may want to replace with your own device.

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment