brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: lsblk -d -o NAME,ROTA tells an SSD from a spinning disk

Disk
~/tips/tip-disk-lsblk-rota-ssd-or-hdd

lsblk -d -o NAME,SIZE,ROTA,MODEL

Shows with one column whether each drive is a spinning disk or flash storage.

Before I pick a tuning option I want to know what kind of disk I am looking at. The kernel already knows.

lsblk -d -o NAME,SIZE,ROTA,MODEL

-d hides the partitions and -o picks the columns. ROTA is 1 for a rotating disk and 0 for an SSD or NVMe drive. The same value lives in /sys/block/sda/queue/rotational, which is handy in scripts. Caveat: a virtual machine or a hardware RAID controller may report 1 for everything, so the number only describes what the system is told.

Further reading: lsblk manual page

More Disk tips sudo e2freefrag /dev/sdb1 sudo smartctl -a --json /dev/sda | jq '.smart_status.passed' lsscsi -s udisksctl power-off -b /dev/sdX du -sh — .[!.]* * 2>/dev/null | sort -h All Disk tips (44) All topics

Link