【Linux】Linux下判断磁盘是SSD还是HDD的几种方法
2020-10-25 本文已影响0人
Bogon
# cat /sys/block/*/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).
通过判断cat /sys/block/*/queue/rotational的返回值(其中*为你的硬盘设备名称,例如sda等等),如果返回1则表示磁盘可旋转,那么就是HDD了;反之,如果返回0,则表示磁盘不可以旋转,那么就有可能是SSD了。
# lsblk -d -o name,rota
使用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