Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Check if Hard Drive is SSD or HDD on Linux
To determine whether our file system uses SSD or HDD technology, we need to identify which type of storage device is used by our Linux system. Understanding storage hardware helps optimize performance and make informed decisions about data placement.
There are many different aspects of Linux storage with numerous tools available for reading and configuring storage devices. We use terms like "drive", "volume", and "mount point" to describe hard drives, optical discs, and USB sticks. To understand the underlying technology, we focus on two key aspects
What physical disk or block device we are examining (using
df)The hardware parameters of that disk (using
hdparm)
Identifying the Physical Disk
We start by checking disk usage with the "disk free" command to identify which physical devices contain our file systems.
$ df -Th -x tmpfs
Filesystem Type Size Used Avail Use% Mounted on /dev/sdb2 ext4 228G 173G 44G 80% / /dev/sdb1 vfat 511M 6.3M 505M 2% /boot/efi /dev/sdc1 fuseblk 466G 352G 114G 76% /media/a/9EE8E134E8E10AFB /dev/mapper/wonder--vg-root ext4 902G 57G 799G 7% /media/a/450c0236-eea5-4a7
The command options used are
-TShows the file system type-hDisplays sizes in human-readable format-x tmpfsExcludes temporary file systems from output
From this output, we identify that our root filesystem is on /dev/sdb2, and we can see other physical devices like sdc and logical volumes under mapper.
Using hdparm to Check Drive Type
The Hard Disk Parameters command (hdparm) can read detailed information from storage drives. It must be run as root since it accesses hardware directly.
Checking SSD Drives
To examine the hardware behind our root filesystem on /dev/sdb, we use the -I option for detailed information
$ sudo hdparm -I /dev/sdb
/dev/sdb: ATA device, with non-removable media Model Number: Samsung SSD 840 EVO 250GB
The model name clearly contains "SSD", indicating this is a Solid State Drive.
Using Nominal Media Rotation Rate
For drives with less obvious naming, we can check the Nominal Media Rotation Rate field
$ sudo hdparm -I /dev/sdc | grep 'Nominal Media Rotation Rate'
Nominal Media Rotation Rate: Solid State Device
When the output shows "Solid State Device", it confirms this is an SSD with no moving parts.
Identifying HDD Drives
For traditional hard disk drives, the rotation rate shows as a numeric value
$ sudo hdparm -I /dev/mapper/wonder--vg-root | grep 'Nominal Media Rotation Rate'
Nominal Media Rotation Rate: 7200
This indicates a mechanical hard drive spinning at 7200 revolutions per minute (RPM).
Key Differences
| Drive Type | Rotation Rate Output | Characteristics |
|---|---|---|
| SSD | "Solid State Device" | No moving parts, faster access |
| HDD | Numeric value (e.g., 7200) | Mechanical spinning disks |
Alternative Methods
You can also use these commands to identify drive types
# Check rotation rate directly $ cat /sys/block/sda/queue/rotational # List all block devices with rotation info $ lsblk -d -o name,rota
A value of 1 indicates rotational (HDD), while 0 indicates non-rotational (SSD).
Conclusion
Linux provides multiple methods to identify storage device types. The most reliable approach combines df to identify physical devices and hdparm -I to examine hardware parameters. The Nominal Media Rotation Rate field definitively distinguishes between SSDs (showing "Solid State Device") and HDDs (showing RPM values).
