Solid state drives (SSDs) are becoming increasingly common in modern computers due to their faster speeds compared to traditional hard disk drives (HDDs). When managing your Linux system, it’s important to know whether your disks are HDDs or SSDs as it can impact performance tuning and partitioning decisions. This guide will walk through several methods to identify if a disk is an SSD or not in Linux.
Check If the Disk is Rotational
The key difference between HDDs and SSDs is that HDDs are rotational media while SSDs are non-rotational. We can use this characteristic to our advantage. The Linux kernel exposes the rotational attribute of disks under /sys. To check if a disk is rotational, run:
cat /sys/block/sdX/queue/rotational
Where sdX is the disk device name (e.g. sda, sdb).
- If the output is 0, the disk is non-rotational (SSD).
- If the output is 1, the disk is rotational (HDD).
This is the quickest way to verify if a Linux disk is an SSD or not.
Use lsblk to Check Rotational Flag
The lsblk
command in Linux lists information about all available block devices including disks. It accepts a -d
flag to only show information on disk devices, and a -o
flag to customize the output columns. To display the names and rotational flags of disks:
lsblk -d -o name,rota
The rota
column will output 0 for SSDs and 1 for HDDs, similar to the previous method.
Check the Disk’s Model Name
Most disk manufacturers encode the type of drive in the model name. SSD model names usually have words like “SSD”, “Solid State”, “NVMe” or related terms. You can find disk models using:
lshw -short -C disk
The output will display the model names of each disk which you can Google to verify if they are SSD or HDD models.
Check the Disk’s Interface Type
SSDs typically connect via interfaces like SATA, NVMe, SCSI, etc. while HDDs usually use SATA. The hdparm
tool can show interface details:
hdparm -I /dev/sdX
The presence of an NVMe or similar SSD-related interface strongly indicates you are dealing with a solid-state disk.
Grep dmesg Output for SSD/NVMe Keywords
The kernel log buffer dmesg
often contains disk-related information on boot. You can grep it to determine if your disks are SSDs:
dmesg | grep -i 'ssd\|nvme'
Matching lines that contain SSD or NVMe-related keywords likely correspond to solid-state drives attached to your system.
Conclusion
There are many ways to verify if a disk is a modern SSD or not in Linux using simple commands. Knowing your disk types allows better partitioning, mount options, and performance tuning. Other advanced techniques like SMART data analysis using smartctl
can also help.