Rate this post

Here is an example of how to check the disk type on a Linux server using the first method:

Copy code# lsscsi
[0:0:0:0]    storage HP       P244br           6.30  -
[0:1:0:0]    disk    HP       LOGICAL VOLUME   6.30  /dev/sda
[0:1:0:1]    disk    HP       LOGICAL VOLUME   6.30  /dev/sdb

This command lists all the available disks on the server. Now we can check the rotational value of these individual disks by using the following commands:

Copy code# cat /sys/block/sda/queue/rotational

# cat /sys/block/sdb/queue/rotational

As the value for both the disks is 1, it means that both disks are HDDs.

Another method is to use the “lsblk” command to list all the available connected disk types and their respective rotational values. For example, the command:

Copy code# lsblk -d -o name,rota

gives the output:

Copy codeNAME  ROTA
sda      1
sdb      1
loop0    1
loop1    1

So all the identified disks have rotational value as 1 so this means they all are part of HDD.

Another way to check the disk type is by using the disk model number. We can get the model number of the disk using the “lsblk” command:

Copy code# lsblk -d -e 7 -o NAME,ROTA,DISC-MAX,MODEL

Example output:

nvme0n1    0       2T SAMSUNG MZQLB960HAJR-00007
nvme1n1    0       2T SAMSUNG MZQLB960HAJR-00007

The output shows that the disks are SSDs because the rotational value is 0. If the value was 1, it would indicate that the disks are HDDs.

It is worth mentioning that if you are using any kind of RAID such as hardware or software RAID, it is possible that you won’t get the model number with the above command. In such cases, you can rely on third-party tools such as ssacli and HPE Array Configuration Utility (acu cli) to get the model number.

For example, on HPE Proliant Blades servers, the output of the command:

Copy code# lsblk -d -e 7 -o NAME,ROTA,DISC-MAX,MODEL

may be:

sda     1       0B LOGICAL VOLUME
sdb     1       0B LOGICAL VOLUME

Instead of the model number, you get “LOGICAL VOLUME”. In this case, you can use the following command to get the physical drive location:

Copy code# ssacli ctrl slot=0 pd all show status

Then you can query the details for this PD:

Copy code# ssacli ctrl  slot=0 pd 1I:1:1 show detail

Which will give you the details of the disk such as the model, serial number, interface type and rotational speed.

Note that these commands should be run in the terminal or command line interface of your Linux server.

About the Author

Shahid Malla

Shahid Malla is an accomplished system admin and web developer, renowned for his expertise in various fields. With a strong background in WHMCS development, WordPress development, and PHP development, Shahid has honed his skills over the years to deliver exceptional results. As a top-rated freelancer, he has consistently garnered praise and recognition, earning a stellar 5-star rating from a pool of 500 reviews. Shahid's proficiency extends beyond coding and development, encompassing server configuration, server management, and web security. With his extensive knowledge and dedication to delivering high-quality solutions, Shahid Malla is your go-to professional for all your technical needs.

View All Articles