I searched and found 2 options, none of which I'm confident provided me the answer.
This output '1' to stdout. What does this mean?
lshw -class disc
but couldn't find anything that answers my question.
Let's try to read 1000 random 4k blocks from first 16GB of a disk:
time for i in `seq 1 1000`; do dd bs=4k if=/dev/sda count=1 skip=$(( $RANDOM * 128 )) >/dev/null 2>&1; done
This is something that should be very slow on rotating drive in comparison with SSD. On my desktop class SSD it ends in about a second. On desktop class 7200rpm rotating drive it ends in 10 seconds.
In a physical machine (not a VPS), you can get the type with
smartctl -a /dev/sda
and grep for
smartctl -a /dev/sda | grep Rotation Rotation Rate: Solid State Device smartctl -a /dev/sdb | grep Rotation Rotation Rate: 5400 rpm
It's quite likely you have no chance to identify the disk type inside a VPS, as the hypervisor abstracts the real hardware away from the guest machines.