How to Check Whether Your Disk Is an SSD or HDD on Linux
Reading Time: 3 minutesTaking apart your laptop just to check the disk type used isn’t a wise decision. It’s much easier to use these Linux commands instead.
Solid-state drives (SSDs) have been on the rise in recent years; they are fast, silent, and less prone to failure than traditional hard disk drives (HDDs). Still, HDDs power a lot of computers.
Not sure what kind of disk drive your Linux PC is using? Here’s how to easily check your disk type without opening the hood.
Differences Between Hard Disks and Solid State Drives
Hard disks store information on a rotating disk known as a platter. They access and write the data to the platter with a rotating head. The rotating platter in hard disks makes noise as it spins whenever data is read or written to the hard disk.
Solid-state drives, on the other hand, use flash memory to store and persist data. There are no moving parts in SSDs hence they’re silent. The advantage of having non-moving parts is that it is less prone to failure. Reading and writing data to an SSD is much quicker than writing to an HDD.
Fortunately, you don’t need to meddle with the hardware to find the disk type of your desktop. Instead, you can use the following Linux commands.
1. Using the lsblk Command
lsblk (list block devices) is a command-line utility for listing block devices, e.g. flash drives and hard drives, on your Linux system. However, the command does not list RAM devices.
The lsblk utility comes as part of most Linux installations. If it’s not available on your system, you can install it using the default package manager of your distro. Run the following command to get the type of disk that you have:
lsblk -o name, rota | tail
The preceding command lists all block devices, including the disk drives on your system. The -o name, rota command flags instruct the lsblk utility to output the name and rotational columns.
A 0 (zero) on the rota column shows that the disk is not rotational hence an SSD. If you get a 1 then the disk is an HDD.
Therefore, the disk for this Linux system is an SSD.
2. Using the cat Command
The cat command is a powerful utility for concatenating files to the standard output. It is also a great alternative for checking your disk type on Linux.
Linux systems contain a file that shows whether your disk is rotational or not. This file is usually located in the /sys/block directory on most systems.
cat /sys/block/sda/queue/rotational
On other systems, you’d need to replace sda in the preceding command with nvme0n1, or something similar.
The output shows that the disk is an SSD because the rotational output is a 0 (zero), or false. If the result is 1, then the disk is an HDD.
3. Using the GUI
On most distros that use GNOME, you can check your disk type using the Files application. Press the Super key then search for Files and launch it. Click the Other Locations tab on the sidebar. It’ll present you with a list of all disk drives. The highlighted disk is marked SSD, hence this system is using an SSD.
Other desktop environments would have similar options to check whether a laptop is using an SSD or HDD as the disk drive.
Upgrade to an SSD for a Faster Linux Experience
The lsblk and cat commands are great utilities for checking the type of disk that your Linux system is using.
SSDs boast many advantages over HDDs. If your PC is using an HDD and you want to improve its performance, consider upgrading to an SSD.