How To Identify HDD Or SSD Drive In Linux? – Andro Gaming Club

[ad_1]

There are various types of disk drives, among which the hard disk drive (HDD) and solid-state drive (SSD) are the most commonly used. As of kernel 2.6.29, SSDs are automatically detected by Linux systems and work fine there.

Distinguishing a hard drive from a solid-state drive is quite simple, if only by its size. SSDs are significantly smaller in size. They also differ in terms of noise level at work. Since there are no moving parts in solid-state SSD drives, they operate absolutely silently and without any vibrations. If we do not have physical access to a computer, then it is much more difficult to determine which disk we are dealing with.

This guide shows you how to check if the installed drive is SSD or HDD in Linux system.

Image Source

Method 1: Using the lsblk command

As we already know, SSD drives have no moving parts. Accordingly, identification of the disc type can be performed using the “spin” parameter of the lsblk command. This command can be used to list all mapped drives and their respective rotation values ​​of those drives:

[nehrena@manjaro-nout ~]$ lsblk -d -o name,rota
NAME ROTA
sda     1
sdb     0

From the output of this command, you can see that the first sda disk is spinning, but the second is not. Thus, you can determine that the sda ​​disk is a regular HDD, and the second disk is an SSD.

Without additional parameters, this command will simply give us a list of all disks and their partitions:

[nehrena@manjaro-nout ~]$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 698,6G  0 disk  
├─sda1   8:1    0   650G  0 part /home
└─sda2   8:2    0  48,6G  0 part  
sdb      8:16   0 119,2G  0 disk  
└─sdb2   8:18   0 119,2G  0 part /

The additional ROTA parameter in the above command equals ” 1 ” to indicate that the drive is a hard drive. In the case of SSD, the ROTA value will be ” 0 “.

Method 2: check disk rotation

Another similar method is also based on the rotation of the disk. Looking at the value of / sys/block / sdX / queue/rotation, you can determine the type of disk, where sdX is the name of the disk. If the value is 1, then you are using a hard disk, and the value 0 indicates the type of disk as SSD. Run the following command to get the disk rotation value. In this example sda ​​and sdb are used to determine the type of disk, you can use the name of any disk available on your system.

[nehrena@manjaro-nout ~]$ cat /sys/block/sda/queue/rotational  
1
[nehrena@manjaro-nout ~]$ cat /sys/block/sdb/queue/rotational   
0
[nehrena@manjaro-nout ~]$

In this method, we do not use any special utilities. We just read data from the device block file.

Output “1” indicates the type of HDD, for SSD the value will be “0”.

Method 3: Using smartctl

The disk type used on Linux can also be determined using the smartctl command-line utility. Smartctl is part of the smartmontools package. smartmontools is available on all Linux distributions including Ubuntu, Fedora, Centos, and RHEL.

If you do not have this utility installed, use the following command to install smartmontools on Linux:

Ubuntu

$ sudo apt install smartmontools

To start the service, run the command:

$ sudo /etc/init.d/smartmontools start

CentOS and RHEL

$ sudo yum install smartmontools 

Fedora

$ sudo dnf install smartmontools

Smartd service will start automatically after installation. If not, use the following command to start the service:

$ sudo systemctl start smartd

After installing the smartmontools package, use the following command to determine if the drive is hard or solid state:

$ sudo smartctl -a / dev / sda | grep 'Rotation Rate'

Where / dev / sda is the drive name.

[nehrena@manjaro-nout ~]$ sudo smartctl -a /dev/sda | grep 'Rotation Rate'
[sudo] пароль для nehrena:  
Rotation Rate:    5400 rpm
[nehrena@manjaro-nout ~]$

This utility will show you the specific speed at which the disk is spinning. For SSD drives, respectively, the speed will be 0.

[nehrena@manjaro-nout ~]$ sudo smartctl -a /dev/sdb | grep 'Rotation Rate'  
Rotation Rate:    Solid State Device
[nehrena@manjaro-nout ~]$

As you can see from the output, the utility honestly said that this is an SSD disk and it does not rotate.

Output

So, using simple examples in this article, we learned how to check if the disk is an SSD or HDD in an OS of the Linux family.

[ad_2]

Leave a Reply