Sorry if this is obvious, but I tried very hard to get an answer.
In my disk upper filter driver, I want to know if the disk is a SSD. Am I supposed to send a STORAGE_PROPERTY_QUERY
with STORAGE_PROPERTY_ID
with StorageDeviceTrimProperty
? I only want to differentiate between “rotational media” and “memory media”. As long I get a “yes” for most current gen SSDs, that is a good enough answer for me.
Regards,
Mridul.
That should work.
What many folks do is watch for IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES with DeviceDsmAction_Trim to be sent by the NTFS and processed by the underlying device.
A lot depends on the specific devices you’re trying to detect. Do you include USB flash drives?
Peter
No USB flash drives. Just the usual internal SSDs via SATA cable or SSD in an external USB enclosure.
Yeah, so… as above. I haven’t done either in a looooong time, but I would say whichever is more convenient.
Since your filter is above Disk Class, you should see the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES go by during initialization… just watch for the completion. Try that…
Peter
Thank you! I will try that.
@craniumrat
Am I supposed to send a STORAGE_PROPERTY_QUERY with STORAGE_PROPERTY_ID with StorageDeviceTrimProperty? I only want to **differentiate between “rotational media” and “memory media”. **
You are almost right, but slightly wrong with StorageDeviceTrimProperty. Use StorageDeviceSeekPenaltyProperty and DEVICE_SEEK_PENALTY_DESCRIPTOR.IncursSeekPenalty
StorageDeviceSeekPenaltyProperty
Interesting. Never noticed that one before.
Can you tell us when StorageDeviceSeekPenaltyProperty will be set to TRUE but StorageTrimProperty or DeviceDsmAction_Trim will be set to FALSE for an SSD?
Peter
Thank you, and again… very interesting.
But, didn’t the IDENTIFY you attached show a good reason not to use Incurs Seek Penalty? This is a virtual disk, not an SSD, and it sets Seek Penalty to FALSE (we can argue about whether that’s correct or not, but no matter). But I bet this “device” does not indicate support for trim. I dunno, maybe it does?
I am glad to know about the Seek Penalty field, I hadn’t seen it before… and it will be interesting to what sets it vs trim in future.
Peter
Ahhh! The second attachment didn’t show up. NOW I get your point.
Yes… very clever.
Fun stuff. Thanks, Mr. SweetLow.
Peter
JFYI
@SweetLow said:
Can you tell us when StorageDeviceSeekPenaltyProperty will be set to TRUE but StorageTrimProperty … will be set to FALSE for an SSD?
Probably it can appear on non flash devices like Optane, but i still don’t have this beast in my hand.
Intel NVMe Optane M.2, MEMPEK1W016GA
--------- Device Trim Descriptor ---------------------
TrimEnabled = Yes
So this kind of devices supports trim (or, probably more precisely, NVMe DSM Deallocate Logical Block).