At some moment, you must have been curious to know if you are using Solid State Drive (SSD) or Hard Disk Drive (HDD) on your Laptop/pC. If so, checking the type of disk drive is quite easy on Linux. There are different methods to verify and check if you are using an SSD or HDD. The Linux operating system can automatically detect SSD since the kernel 2.6.29 was introduced.
In this article, we are going to discuss the ways to check if it is an SSD or HDD on Ubuntu 20.04 LTS server.
Checking with the use of lsblk command
To check the disk type if it is SSD or HDD in Linux, we can use lsblk command. It is due to the rotational feature of the disk. If the lsblk command is not found on your Linux distribution like Ubuntu 20.04 then you can install it with the command below.
$ sudo apt install util-linux
Then to check the disk types, run the following command by using lsblk as shown below.
$ lsblk -d -o name,rota
To be clear, if the ROTA value is 1, then your disk type is HDD and if the ROTA value is 0 then it is SSD. Here, you can see 1 on the above screenshot for the ROTA value of sda, vda which means it is HDD.
Checking if the disk is rotational
Hard disk drive (HDD) works with the rotation of the disk while SSD does not have such rotational disk. To verify if you are using an SSD or HDD, you have to check if it is rotational or not. If it is rotational then the value must be 1, if not then it is 0.
To check that value, you have to print the value of /sys/block/sdX/queue/rotational. For further details, run the command as shown below.
$ cat /sys/block/sda/queue/rotational
Here, the value is 1 which means the disk type is Hard disk drive(HDD). If the value is 0 then it is an SSD.
Another example of checking if the disk is rotational, run the command as shown below.
$ cat /sys/block/vda/queue/rotational
Here, the value is also 1 which means the disk type is Hard disk drive(HDD). If the value is 0 then it is an SSD.
Checking with the use of monitoring tool- smartctl
This is the smart way to check the disk type if it is SSD or HDD. As the smart monitoring tool is such a package which consists of the unique command line tool called smartctl. So to install such a tool on ubuntu 20.04 LTS server, you can run the command as shown below.
$ sudo apt install smartmontools -y
Now check if the smartd service is running or not with the following command.
$ sudo systemctl status smartd
If it is not active by default, you can start it with the command as shown below.
$ sudo systemctl start smartd
As the smartd service is running, run the command as shown below to check if you are using HDD or SSD.
$ sudo smartctl -a /dev/sda | grep 'Rotation Rate'
Here, we are checking for drive sda.
With the above command, if the drive is SSD then the output will be as shown below.
Rotation Rate: Solid State Device
And, if the drive is HDD then the output will be as shown below.
Rotation Rate: 5400 rpm
In this article, we have discussed the ways to check if the disk is HDD or SSD in a Linux operating system like Ubuntu 20.04 LTS server. If you have been curious about it, try any of the above ways to find it. Thank you!
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.