How to determine storage type (SSD drive or HHD .m

2019-05-21 03:57发布

How can I, from a C program, read the hardware information of a drive? (I.e. to determine if the drive is an SSD or a mechanical disk.)

4条回答
三岁会撩人
2楼-- · 2019-05-21 04:00

This guess is a long shot but I can't find anything better. In the device's identification structure, see if it supports acoustic management. Old disk drives didn't, but maybe most modern disk drives do. Obviously SSDs don't need acoustic management but let's hope they'll say they don't, instead of pretending to be disk drives.

查看更多
看我几分像从前
3楼-- · 2019-05-21 04:04

SSD are supposed to identify themselves as non-rotative. For linux, as example, you can get the info via sysfs:

cat /sys/block/sda/queue/rotational

If it returns 0, you have SSD...

查看更多
beautiful°
4楼-- · 2019-05-21 04:13

You can use the GetDriveType Method from the win32 library, and you might be able to differentiate that way, or you use GetVolumeInformation to try and determine it from the label.

查看更多
Deceive 欺骗
5楼-- · 2019-05-21 04:21

Have you considered doing a read/write test to try to determine capabilities ?

查看更多
登录 后发表回答