I want to know whether a disk is a solid-state drive or hard disk.

lshw is not installed. I do yum install lshw and it says there is no package named lshw. I do not know which version of http://pkgs.repoforge.org/lshw/ is suitable for my CentOS.

I search the net and there is nothing that explain how to know whether a drive is SSD or HDD. Should I just format them first?

Result of fdisk -l:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00074f7d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          14      103424   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              14         536     4194304   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             536       14594   112921600   83  Linux

Disk /dev/sdc: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdd: 480.1 GB, 480103981056 bytes
255 heads, 63 sectors/track, 58369 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
  • 1
    If this really is a SSD you might want to reformat it to align the erase blocks with the partitions.
    – symcbean
    Commented Feb 21, 2013 at 13:58
  • 3
    SATA (Serial ATA) refers to the connection type of the drive, and does not imply that it is a Hard Disk Drive (HDD). SSDs can simultaneously be SATA, so I'm suggesting an edit to the title.
    – SpellingD
    Commented Feb 21, 2013 at 17:10
  • How to check if my Ubuntu is placed on SSD?
    – phuclv
    Commented Dec 6, 2016 at 2:21
  • Nowadays, the output of fdisk -l also includes a Disk model line for each physical disk, where SSD disks typically have the string SSD in their model name which appears there (at least on my system, and otherwise you could search the Internet for the model). But other answers below are perhaps more robust.
    – matanox
    Commented Jun 6, 2021 at 17:55

10 Answers 10


Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with:

cat /sys/block/sda/queue/rotational

You should get 1 for hard disks and 0 for a SSD.

It will probably not work if your disk is a logical device emulated by hardware (like a RAID controller).

See this answer for more information about SSD partitioning, filesystem...

  • 2
    On Stackoverflow somebody found this sys-info didn't work.
    – PythoNic
    Commented Jul 23, 2014 at 10:55
  • 1
    @totor Better add this comment on the other post. I don't know his/her kernel version :)
    – PythoNic
    Commented Sep 4, 2014 at 13:21
  • 4
    @Totor You are correct in the "hybrid" drives. However, dual-drive hybrids show up as two individual drives, where SSHD (Solid-State Hybrid Drive) shows up as a single drive. So, the SSHD would show rotational of 1.
    – Terrance
    Commented Jun 30, 2016 at 16:18
  • 8
    On virtual servers, you may need to fetch /sys/block/vda/queue/rotational Commented Nov 8, 2016 at 21:45
  • 2
    @Ferrybig There are only SSDs in NVME format, not HDDs (unless you do have some strange breakout adapter from NVME slot to plain SATA cable). But not sure if even SATA SSD over NVME shows as NVME in linux or as plain sdX.
    – Marki555
    Commented Dec 3, 2019 at 9:20

With lsblk (part of the util-linux package):

lsblk -d -o name,rota
sda     0
sdb     0
sdc     1

where ROTA means rotational device (1 if true, 0 if false).

Note that, as mentioned in the comments, some USB controllers don't correctly report this rotational attribute, a possible fix being the use of an explicit UDEV rule.

Also, more recent versions of lsblk support the -I,--include and -e,--exclude options that allow filtering devices by major number and also support JSON output so e.g. to show only the name and serial number of non-loop devices that are non-rotational you could run:

lsblk -e 7 -do name,serial,rota --json | \
jq -r '.blockdevices[] | select(.rota==false) | [.name,.serial] | @tsv'
  • 3
    That utility seems to report the same information as in /sys/block/.../rotational.
    – dma_k
    Commented Oct 20, 2015 at 10:45
  • @dma_k Little wonder, considering it appears to use that one. Try it yourself: strace lsblk -d -o name,rota /dev/sda 2>&1 | grep --context=3 --color rotational
    – user
    Commented May 13, 2016 at 16:30
  • 5
    Actually I was looking into various ways because some USB controllers don't tell that drive is actually non-rotational (for example, USB flash) and there is no way in Linux to tell the truth. At the end of the day I have fixed that by creating the explicit rule in /etc/udev/rules.d/90-non-rotational.rules: ACTION=="add|change", SUBSYSTEMS=="usb", ENV{ID_SERIAL}=="SanDisk_Ultra_Fit_*-0:0", ATTR{queue/rotational}="0", ATTR{queue/scheduler}="deadline"
    – dma_k
    Commented Jun 8, 2016 at 18:01
  • 1
    lsblk reports "0" for all my good old SATA spinning HDDs here (ASROCK mobo). « some USB controllers don't tell that drive is actually non-rotational (for example, USB flash) » @dma_k this is so true --and better this way than the other way for USB wired external spinning HDDs IMHA.
    – tuk0z
    Commented Sep 14, 2016 at 20:45
  • 4
    This works best for me, but it includes redundant/unwanted loop devices (e.g. due to Ubuntu snaps). A slight improvement is: lsblk -d -e 7 -o NAME,ROTA,DISC-MAX,MODEL which excludes loop devices + adds the model name (manufacturer) and disk capacity.
    – arielf
    Commented Jan 28, 2020 at 16:01

Use smartctl (install by installing smartmontools) to retrieve vendor information,

sudo smartctl -a /dev/sdb

If you see a line like this,

Rotation Rate: Solid State Device

That would be a SSD drive.


I needed to do this on the VPS and none of the provided solutions worked for me, but this answer did the trick:


This just reads random data from the drive and assesses the time.

time for i in `seq 1 1000`; do
    dd bs=4k if=/dev/sda count=1 skip=$(( $RANDOM * 128 )) >/dev/null 2>&1;

NOTE: You may need sudo before the dd command, depending on your permissions.

Here are my results for an SSD:

real    0m1.375s
user    0m0.285s
sys     0m0.944s

And a HDD:

real    0m14.249s
user    0m0.752s
sys     0m6.284s

As you can see, the HDD takes about 10x the duration. This may not be reliable for some very fast HDD's, but in general, it will give you a good idea.

  • 1
    I have a non-ssd, RAID10, and my results are: real 0m1.351s - user: 0m0.307s - sys: 0m0.560s
    – the_nuts
    Commented Apr 10, 2016 at 10:48
  • 5
    This is a good answer and it does work across the board. The thing is some HDDs are quite fast and the results can be similar to those of SSDs. Still, this answer provides a good metric.
    – itoctopus
    Commented Jun 10, 2016 at 4:57
  • 1
    On my VPS without an SSD this provides results like your SSD example. I believe this may be fooled by "hybrid" (SSD cached HDD) setups.
    – trr
    Commented Aug 16, 2016 at 1:40
  • doesn't work for me. I find SSD and HDD produce similar result.
    – qqibrow
    Commented Oct 3, 2018 at 20:46
  • 1
    On a VPS hardware's virtualized. You can't really tell if your files are stored on a HDD, cached, or stored on a SSD.
    – vidarlo
    Commented Feb 9, 2019 at 22:45

The other answers already tell you how to get this information in a number of ways , including /proc. But you must expect all these mechanisms to lie if there's any virtualisation in the way, such as a hybrid SAN array with multiple tiers, or if the Linux machine is a virtual machine (where Linux will probably report the disk as a basic SCSI rotating disk, regardless of what the hardware really is)

  • this may be one of the more important responses... and also within the BIOS, or EFI/UEFI one may need to set the SATA controller mode to AHCI and then also mark each disk as SSD within the bios. My Asrock board on home pc is like this, can't remember if there was a similiar thing on server boards (supermicro) I have at work but i don't use SSD at work.
    – ron
    Commented Aug 16, 2018 at 17:50
  • @ron - What do you mean by setting the SATA controller mode to AHCI? How does it affect the ability to accurately report if the device is a SSD or not?
    – Motivated
    Commented Dec 28, 2018 at 5:03
  • look up AHCI vs IDE, wording from first web search: IDE is considered adequate for the average computer user, and is the most compatible with other technology, particularly older devices. However, it lacks support for new technologies...AHCI provides a standard system that designers and developers can use to configure, detect, or program SATA/AHCI adapters.*
    – ron
    Commented Jan 3, 2019 at 22:29
  • that is a basic settings in the BIOS, somewhere under Storage, the choices are IDE, AHCI, and also depending on make/model/year of motherboard can also offer RAID. SSD's came out long after IDE basically went obsolete and the standard became AHCI, For example installing Windows95 on a computer today it would not recognize any hardware... being in IDE mode certainly would not help communication with a SSD not so much accuracy but simply being able to communicate with a SATA controller which is based on AHCI protocols.
    – ron
    Commented Jan 3, 2019 at 22:33

check cat /proc/scsi/scsi. there you should see the exact model of your disk. then you just google the model to find info about it.

  • 3
    dmesg will contain the same info. dmesg | grep -i -e scsi -e ata
    – Matt
    Commented Feb 21, 2013 at 9:41

This is an old post but I wanted to share another way to do this which I found out by accident:

sg_vpd --page=bdc /dev/sda

This commands fetches the Vital Product Data for the block device characteristics. For a rotating head disk, the output will include: Nominal rotation rate: 7200 rpm For an SSD, it will include: Non-rotating medium (e.g. solid state)

  • 1
    +1. nice, but running that on my (aging and soon to be replaced) WD Greens says Medium rotation rate is not reported. hdparm and smartmonctl say the same. I guess WD don't want to tell.
    – cas
    Commented Aug 4, 2016 at 13:41
  • sg_vpd -i might be more useful, at least it gives vendor info on from the drive. Doesn't work on a raid, tho'.
    – Dale
    Commented Jan 11, 2019 at 16:30

Type this in your Linux terminal:

cat /proc/scsi/scsi

Like mine:

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST1000LM024 HN-M Rev: 0004
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: SAMSUNG SSD PM83 Rev: 3D1Q
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: HL-DT-ST Model: DVD+-RW GT80N    Rev: A103
  Type:   CD-ROM                           ANSI  SCSI revision: 05

You can see the model of your hard drive if it is SSD or HHD.

  • This seems to show only ATA/SCSI block-devices, others such as NVMe SSDs do not show.
    – arielf
    Commented Jan 27, 2020 at 22:36
  • if your disk is behind a raid controller, you will only see the raid controller such as Vendor: LSI Model: SMC3108 Rev: 4.27
    – ron
    Commented Jan 28, 2020 at 22:01
find /sys/block/* -maxdepth 1 -exec echo {} \; -exec grep '0' {}/queue/rotational \; | grep -B1 '^0' | grep '^/' | sed 's/^.*\///g'

This searches all block devices and check to see if it is rotary (1); if not (0) it is ssd.

This only displays discs marked as ssd.

  • ajouté | grep -v 'loop' dans la commande pour ignorer les "block device" virtuel ex: for SsDrive in $(find /sys/block/* -maxdepth 1 -exec echo {} \; -exec grep '0' {}/queue/rotational \; | grep -v 'loop' | grep -B1 '^0' | grep '^/' | sed 's/^.*\///g') ; do find /dev/ -name $SsDrive[0-9] ; done
    – user515185
    Commented Jan 28, 2020 at 21:50
  • I noticed after my translation yesterday that you've previously rolled back attempted translations. Please note that answers on this site should be in English. Thank you!
    – Jeff Schaller
    Commented Jan 30, 2020 at 17:56
  • Add | grep -v 'loop' on the command line to forget the loop (virtual block device ) ex: for SsDrive in $(find /sys/block/* -maxdepth 1 -exec echo {} \; -exec grep '0' {}/queue/rotational \; | grep -v 'loop' | grep -B1 '^0' | grep '^/' | sed 's/^.*\///g') ; do find /dev/ -name $SsDrive[0-9] ; done
    – user515185
    Commented Jan 30, 2020 at 21:20

If you want to be lazy and realy want to read something like ssd or hdd give

sudo lshw -short -C disk

a try.

My Output shows both:

H/W path         Device      Class          Description
/0/100/17/0      /dev/sda    disk           1TB TOSHIBA MQ01ABD1
/0/100/17/1      /dev/sdb    disk           128GB SSD PHISON 128GB
/0/100/17/0.0.0  /dev/sr0    disk           DVDRAM GUD0N
  • Description does not always include "HDD" or "SSD".
    – gavv
    Commented Feb 19, 2022 at 11:31
  • @gavv hm, it's strange ... the 'lshw' is may be the best utility that gives the most detailed info about the hardware on a system. but it doesn't tell the type of the disk! may be it is time to upgrade the 'lshw' to a new version. :)
    – ccsann
    Commented Aug 9, 2022 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .