Checking if a Disk is an SSD or HDD from CLI
When deploying storage solutions (like Longhorn in Kubernetes), you often need to confirm if your nodes are using SSDs or spinning disks (HDDs).
You can easily check the "rotational" status of your disks using lsblk:
The ROTA column stands for "rotational":
0= SSD (Non-rotational)1= HDD (Spinning disk)
Example Output
In this example, sda is an SSD and sdb is a spinning disk.
Identifying Disk Usage
Once you know which disks are SSDs and HDDs, you need to understand what each disk is actually doing. This is where lsblk -o NAME,SIZE,MOUNTPOINT becomes extremely useful. It tells you the size of the disk and where it is mounted in your system, helping you easily distinguish your OS drive from secondary storage.
leva@k8s-cp-01:~$ lsblk -o NAME,SIZE,MOUNTPOINT
NAME SIZE MOUNTPOINT
sda 931.5G
└─sda1 931.5G
sdb 238.5G
├─sdb1 976M /boot/efi
├─sdb2 225.2G /
└─sdb3 12.3G
In the output above, sdb has partitions mounted to crucial system directories like / (root) and /boot/efi, meaning it is the primary OS drive. The other disk, sda (931.5G), has no mount points listed and is likely a secondary drive used for bulk storage (media, etc.).
Why this matters: When a node (like a laptop or gaming PC) has mixed disk types, combining this output with the ROTA check is critical. If your sda drive is the SSD and your sdb drive is the HDD, you must explicitly configure Longhorn to use the SSD (sda) path when you set it up. This prevents Longhorn from automatically or accidentally placing your persistent volumes on a slow spinning disk, which would severely degrade Kubernetes performance.
Alternative Method
If you need more detail on a specific disk (e.g., sda), you can check the sysfs filesystem directly:
(Outputs 0 for SSD, 1 for HDD)