方法

法1:通过查看/sys/block/sda/queue/rotational

通过cat /sys/block/sda/queue/rotational进行查看,返回值0即为SSD;返回1即为HDD。

 

法2:通过lsscsi查看

lsscsi - list SCSI devices (or hosts) and their attributes

实例

HDD

[root@ssd-test thatsit]# cat /sys/block/sda/queue/rotational
1
[root@ssd-test thatsit]# lsscsi
[0:0:32:0] enclosu DP BP12G+ 1.00 -
[0:2:0:0] disk DELL PERC H310 2.12 /dev/sda
[root@ssd-test thatsit]#

SSD

[root@hdd-test thatsit]# cat /sys/block/sda/queue/rotational
0
[root@hdd-test thatsit]# lsscsi
[0:0:0:0] disk ATA INTEL SSDSC2BX48 0150 -
[0:0:1:0] disk ATA INTEL SSDSC2BX48 0150 -
[0:1:0:0] disk LSI Logical Volume 3000 /dev/sda
[root@hdd-test thatsit]#