7 easy methods to check disk type (HDD or SSD) in Linux

In this article I will share different commands which can be used to check the hard drive (disk) type in your Linux environment. I have verified these commands on RHEL/CentOS Linux so if you are using a different distribution such as Ubuntu, Debian, etc then some of the commands may now work.


Check disk type (HDD or SSD)

There are different types of disk available out of which the most used are Hard Drive (HDD) and Solid State Drive (SSD). You can use the following methods to identify your disk type whether it is HDD or SSD


Method 1: Check if the disk is rotational

You should check the value of /sys/block/sdX/queue/rotational, where sdX is the drive name. If the value is 0, you're dealing with an SSD, and 1 means plain old HDD.

These are the available disks on my Linux server:

# lsscsi
[0:0:0:0]    storage HP       P244br           6.30  -
[0:1:0:0]    disk    HP       LOGICAL VOLUME   6.30  /dev/sda
[0:1:0:1]    disk    HP       LOGICAL VOLUME   6.30  /dev/sdb

Now we can check the rotational value of these individual disks:

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

# cat /sys/block/sdb/queue/rotational

As the value for both the disks are 1, it means my both the disks are HDD.


Method 2: Using lsblk

Here also we will use the concept of identifying the disks with rotational feature to check the disk type. Although here we are using lsblk to list all the available connected disk types and their respective rotational values:

# lsblk -d -o name,rota
sda      1
sdb      1
loop0    1
loop1    1

So all the identified disks have rotational value as 1 so this means they all are part of HDD.

Here I have another setup with SSD disks:

7 ways to check disk type & interface type in Linux


Method 3: Using disk model number

We can get the model number of the disk using lsblk command:

# lsblk -d -e 7 -o NAME,ROTA,DISC-MAX,MODEL
nvme0n1    0       2T SAMSUNG MZQLB960HAJR-00007
nvme1n1    0       2T SAMSUNG MZQLB960HAJR-00007

If you are using any kind of RAID such as hardware or software raid then it is possible you won't get the model number with above command. In such case we have to rely on some third party tools. For example on my HPE Proliant Blades we are using hardware and software raid so on those servers I get following output:

# lsblk -d -e 7 -o NAME,ROTA,DISC-MAX,MODEL
sda     1       0B LOGICAL VOLUME
sdb     1       0B LOGICAL VOLUME

As you see instead of Model Number, I get "LOGICAL VOLUME" so here I rely on HPE third party software such as ssacli and HPE Array Configuration Utility (acu cli) to get the model number. First we need the physical drive location, which can be collected using:

# ssacli ctrl slot=0 pd all show status

   physicaldrive 1I:1:1 (port 1I:box 1:bay 1, 900 GB): OK
   physicaldrive 1I:1:2 (port 1I:box 1:bay 2, 900 GB): OK

Now that we have the Physical Drive location i.e. 1I:1:1, we can query the details for this PD:

# ssacli ctrl  slot=0 pd 1I:1:1 show detail

Smart Array P244br in Slot 0 (Embedded)

   Array A

      physicaldrive 1I:1:1
         Port: 1I
         Box: 1
         Bay: 1
         Status: OK
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 900 GB
         Drive exposed to OS: False
         Logical/Physical Block Size: 512/512
         Rotational Speed: 10000
         Firmware Revision: HPD6
         Serial Number: 17E0A0DXFUWB1702
         WWID: 50000397881B3406
         Model: HP      EG0900JETKB
         Current Temperature (C): 31
         Maximum Temperature (C): 40
         PHY Count: 2
         PHY Transfer Rate: 12.0Gbps, Unknown
         Drive Authentication Status: OK
         Carrier Application Version: 11
         Carrier Bootloader Version: 6
         Sanitize Erase Supported: True
         Sanitize Estimated Max Erase Time: 4 hour(s), 14 minute(s)
         Unrestricted Sanitize Supported: False
         Shingled Magnetic Recording Support: None

As you see it gives us a bunch of information about the drive we are using along with the model number.

Now that we have the model number of both our disk, we can search for the specification guide of these disks. For example the above model number is for Smasung disk which as per their online specification guide is SSD

You can also use different commands to get the model number of the disks, such as

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

This can give you a long list of output but you can filter the model number from the output, sample below from my server:

[    2.637090] hpsa 0000:07:00.0: scsi 0:0:0:0: added RAID              HP       P244br           controller SSDSmartPathCap- En- Exp=1
[    2.637106] hpsa 0000:07:00.0: scsi 0:0:1:0: masked Direct-Access     HP       EG0900JETKB      PHYS DRV SSDSmartPathCap- En- Exp=0
[    2.637115] hpsa 0000:07:00.0: scsi 0:0:2:0: masked Direct-Access     HP       EG0900JETKB      PHYS DRV SSDSmartPathCap- En- Exp=0


Check disk interface types

Now that you are familiar with the type of disk you are using, you should know the type of disk interface you are using in your environment. The different types of available disk interface types are

  • Advanced technology attachment (ATA)
  • Integrated Drive Electronics (IDE)
  • Serial ATA (SATA)
  • Small Computer system interface (SCSI)
  • Serial attached SCSI (SAS)
  • Fibre Channel


Method 1: Using lspci

lspci is a utility for displaying information about PCI buses in the system and devices connected to them. We can grep for the specific interface type from the output of lspci

~]# /usr/sbin/lspci | grep IDE
00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)

~]# /usr/sbin/lspci | grep SATA
00:0d.0 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 02)

~]# /usr/sbin/lspci | grep Fibre
04:00.2 Fibre Channel: Emulex Corporation OneConnect 10Gb FCoE Initiator (be3) (rev 01)
04:00.3 Fibre Channel: Emulex Corporation OneConnect 10Gb FCoE Initiator (be3) (rev 01)


Method 2: Using lshw

lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines. It currently supports DMI (x86 and IA-64 only), OpenFirmware device tree (PowerPC only), PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), SCSI and USB

Here is a sample output with SCSI disk interface

~]# lshw -c storage -c disk
          description: SCSI Disk
          bus info: scsi@0:1.0.0
          description: SCSI Disk
          bus info: scsi@0:1.0.1

Here is a sample output with SATA interface

       description: SATA controller
       product: 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode]
       vendor: Intel Corporation
       physical id: d
       bus info: pci@0000:00:0d.0

Here is a sample output from NVME disks

       description: Non-Volatile memory controller
       product: Samsung Electronics Co Ltd
       vendor: Samsung Electronics Co Ltd
       physical id: 0
       bus info: pci@0000:41:00.0

Here is a sample output with ATA disk interface

          description: ATA Disk
          bus info: scsi@2:0.0.0
          logical name: /dev/sda
          description: ATA Disk
          bus info: scsi@3:0.0.0
          logical name: /dev/sdb


Why the bus info is SCSI when the disk interface type is ATA Disk?

If you observe the above output, we have ATA as the disk interface while the bus info is SCSI. The bud info is SCSI because that is the subsystem that provides IO for these disks.
It basically means that even though the disk interface is ATA, the drivers interact to the next kernel layer (the generic disk driver) using SCSI. This isn't actually true of all SATA drivers on all kernel versions with all kernel compile-time configurations, but it's common. Even PATA devices can appear as SCSI at that level (again, that depends on the kernel version and kernel compile-time configuration, as well as whether the ide-scsi module is used).

You can read more about this at Why do my SATA devices show up under /proc/scsi/scsi?


Method 3: Using hdparm

hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older IDE driver sub-system. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore may also work with hdparm.

We can use -I with hdparm which will request identification info directly from the drive, which is displayed in a new expanded format. Here are some example outputs:

# hdparm -I /dev/sda


ATA device, with non-removable media
        Likely used: 1
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown

But hdparm works exclusively with devices which speak the ATA protocol, for disks with other protocols, you may get the following error:

HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device


Method 4: Using lsblk

This can be one of the most reliable method to get the disk interface type. lsblk lists information about all available or the specified block devices. Using -o with lsblk we can print additional columns. To get the disk interface type we can use "TRAN" which will print the device transport type.

For example on a server using Fibre Channel:

~]# lsblk -do name,tran | egrep -v loop
sda  fc
sdb  fc
sdc  fc
sdd  fc
sde  fc
sdf  fc
sdg  fc
sdh  fc

On a server using HDD, here both the disks are using SAS protocol.

~]# lsblk -do name,tran | egrep -v loop
sda   sas
sdb   sas

On Virtual Box environment, the virtual disks are using SATA while the DVD is using ATA protocol:

~]# lsblk -do name,tran | egrep -v loop
sda  sata
sdb  sata
sr0  ata
sr1  ata



In this tutorial we explored different commands and methods which can be used to check the disk type and the disk interface type used to detect the disks in the server. But before you use these commands, you should be familiar with all the different disk and interfaces available.


Related Posts: how to check my hard disk is ssd or hdd. how to check if you have a solid state drive. what kind of hard drive do I have. how to check ssd. how to check disk type hdd or ssd. how to check disk interface type in Linux.

Leave a Comment

Please use shortcodes <pre class=comments>your code</pre> for syntax highlighting when adding code.