So why would you want to find out whether your Linux system is running on SSD or HDD? There are various valid reasons for this question.
Firstly, you might not be tech-savvy enough to understand the hardware infrastructure associated with your Linux system. Secondly, knowing whether your Linux system runs on SSD or HDD helps set reasonable performance expectations for your Linux machine.
Understanding HDD vs SSD
Traditionally, hard drives were defined as spinning devices with non-volatile storage. The implication of the latter statement is that the hard drives were able to retain the integrity of stored data even after a sudden power loss or when power was instantly turned off.
Therefore, the combination of a metal platter with a magnetic coating cover gives us the physical definition of a hard disk drive. For a user or application to successfully read/write data on a hard disk drive, the metal platter with a magnetic coating needs to be in a spinning state. The HDD performance depends on these spins rate such that a faster spin equals better HDD performance.
SSD or Solid State Drive takes advantage of interconnected flash memory chips to store data. Also, when power is turned off or during a sudden blackout, SSD to does not lose already stored data.
However, in comparison to HDD’s metal platter, SSD’s flash memory chips are more reliable due to their unmatched speed. Also, SSD outshines HDD in terms of applications’ launch time, their responsiveness, and startup time.
Finding Out If Linux System Runs on SSD or HDD
For this portion of the article, we are going to look at practical steps that will reveal if your Linux system is running on SSD or HDD.
1. Check Linux Disk is Rotational or Not
Linux operating system distributions that are using kernel version 2.6.29 or later versions have the capability of automatically detecting whether they run on SSD or HDD.
Querying the file /sys/block/sda/queue/rotational on your Linux terminal will confirm to us whether the disk you are using is rotational or not. As per our earlier discussion on HDD vs SSD, only HDD is rotational due to the metal platter that needs to be in a constant spinning state for us to read/write data.
If querying this file outputs 1, then the machine is using HDD and if the output is 0, the machine is using SSD.
We can use the cat command to implement the needed file query command:
$ cat /sys/block/sda/queue/rotational
The above output confirms that the disk is rotational hence HDD.
2. Using the lsblk Command
The lsblk command is primarily used to list block devices on your system. It can however help us determine if the disk we are using is rotational (HDD) or not (SSD).
$ lsblk -d -o name,rota
An output of
1 confirms that this system is using HDD.
3. Using dmesg Command
The dmesg command is effective in printing or control the kernel ring buffer. We can however pipe it to a grep command and retrieve information on the disk model we are using. Afterward, a simple Google search should tell us whether we are using HDD or SSD.
$ sudo dmesg | grep -i -e scsi -e ata
Pasting ST320LT020-9YG14 on Google should tell us whether we are using HDD or SSD.
4. Querying /proc/scsi/scsi Proc File
The /proc/scsi/scsi file contains the disk model information of our system.
$ cat /proc/scsi/scsi
A simple Google search on the revealed disk model should tell us whether we are using HDD or SSD.
Know of other cool ways of identifying whether a Linux system is running on SSD or HDD? Feel free to leave a comment or feedback.