It will probably not work if your disk is a logical device emulated by hardware (like a RAID controller).
通过判断cat /sys/block/*/queue/rotational的返回值(其中*为你的硬盘设备名称,例如sda等等),如果返回1则表示磁盘可旋转,那么就是HDD了;反之,如果返回0,则表示磁盘不可以旋转,那么就有可能是SSD了。
使用lsblk命令进行判断,参数-d表示显示设备名称,参数-o表示仅显示特定的列。
How to know if a disk is an SSD or an HDD
https://unix.stackexchange.com/questions/65595/how-to-know-if-a-disk-is-an-ssd-or-an-hdd
Linux下判断磁盘是SSD还是HDD的几种方法
https://blog.csdn.net/sch0120/article/details/77725658
Linux下如何查看硬盘是固态硬盘SSD还是机械硬盘HDD
https://blog.csdn.net/qq_40586364/article/details/103908967
Which linux filesystem works best with SSD
https://superuser.com/questions/228657/which-linux-filesystem-works-best-with-ssd
法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
会有明显的提示硬盘为SSD还是HDD。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)