Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with:
cat /sys/block/sda/queue/rotational
You should get 1 for hard disks and 0 for a SSD.
# It is not exact in the onecloudsystem pluged in with a usb hard drive.
Use smartctl (install by installing smartmontools) to retrieve vendor information,
sudo smartctl -a /dev/sdb
If you see a line like this,
Rotation Rate: Solid State Device
it is about reading random data from the drive and assessing the time.
time for i in `seq 1 1000`; do
dd bs=4k if=/dev/sda count=1 skip=$(( $RANDOM * 128 )) >/dev/null 2>&1;
done
here are my results for SSD
real 0m1.375s
user 0m0.285s
sys 0m0.944s
and HDD
real 0m14.249s
user 0m0.752s
sys 0m6.284s