Determine if a disk is SSD or HDD

This is one of those random things I do and decided to put it in the website. I know that my personal computer is running on HDD, but when I am logged into a remote Linux system and suddenly I started wondering about how to determine if the underlying disk is SSD or HDD, I wasn’t too sure what to look for. A quick Google search returned the best possible solution and I thought, hey maybe I should just write a small How to about “How to determine if a disk is SSD or HDD”.

Hard Disk Drive (HDD)

A hard disk drive (HDD) is a data storage device used for storing and retrieving digital information using rapidly rotating disks (platters) coated with magnetic material. An HDD retains its data even when powered off. Data is read in a random-access manner, meaning individual blocks of data can be stored or retrieved in any order rather than sequentially. An HDD consists of one or more rigid (“hard”) rapidly rotating disks (platters) with magnetic heads arranged on a moving actuator arm to read and write data to the surfaces.

Solid State Drive (SSD)

A solid-state drive (SSD) (also known as a solid-state disk or electronic disk, though it contains no actual disk, nor a drive motor to spin a disk) is a data storage device that uses integrated circuit assemblies as memory to store data persistently. SSD technology uses electronic interfaces compatible with traditional block input/output (I/O) hard disk drives, thus permitting simple replacement in common applications. Additionally, new I/O interfaces, like SATA Express, have been designed to address specific requirements of the SSD technology.

Determine if a disk is SSD or HDD

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. In my case, I get 1 (cause it’s a 7200RPM rotational HDD).

Determine if a disk is an SSD or an HDD - blackMORE Ops - 1

Check Also

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

This is a guide for configuring Raspberry Pi4 to boot Ubuntu from external USB SSD …

How to fix You can’t access this shared folder because your organization’s security policies block unauthenticated guest access error on Windows 11

If you have the following error on Windows 11 “You can’t access this shared folder …

6 comments

  1. I wonder why I get back a 1 when I most definitely have an SSD. I am running Kali in VirtualBox, but I would imagine that it could still tell what type the underlying drive is. I guess not though, there must be something about the virtualization that disguises it as an HDD.

    • I am no expert, but my guess is that the guest has no knowledge whatsoever of your real hardware and the hypervisor is only presenting a virtual HD to it.

  2. How to fix if you have a SSD and ‘cat /sys/block/sda/queue/rotational’ returns ‘1’ ?

  3. This has been proven invalid multiple times on multiple sites. Here’s a better way:
    for x in df | head -2 | tail -1 | awk {'print $1'} | sed s'/.$//'; do smartctl -a $x | grep “Rotation Rate” ;done

    If you get nothing, it’s an SSD or a VM. If you get a result, it’s a SATA/SCSI/SAS drive.

  4. this will not display true information if ssd is on RAID 10, I’m using Dell R310 with builtin raid 10 with 4 ssd drives

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from blackMORE Ops

Subscribe now to keep reading and get access to the full archive.

Continue reading

Privacy Policy on Cookies Usage

Some services used in this site uses cookies to tailor user experience or to show ads.