不依赖外部软件的话
cat /sys/block/sda/queue/rotational
返回0是SSD硬盘,如果返回1 代表是普通硬盘
如果是虚拟化的,把sda改为vda或者其他盘符即可
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 will probably not work if your disk is a logical device emulated by hardware (like a RAID controller).
See this answer for more information…
你这也改改 模板