How to detect an eSATA drive

Hi

I Have a minifilter driver where I want to block access to an eSATA drive.

How can I identify an eSATA drive as a Removable media/drive ?

In my InstanceSetup callback, I retrieve the volume properties (FltGetVolumeProperties), but the Device Characteristics does not have the FILE_REMOVABLE_MEDIA flag set.
I also try issuing the IOCTL_STORAGE_GET_HOTPLUG_INFO ioctl, but is does not show as hot pluggable. However this works for USB.

I also tired IOCTL_STORAGE_GET_MEDIA_TYPES and IRP_MN_QUERY_CAPABILITIES ioctls on by volume object but they all seem to fail.

Can someone please help.

Thanks,
SS

>How can I identify an eSATA drive as a Removable media/drive ?

On pre-Win7, you just plain cannot.

And even on Win7 you cannot, if the SATA-to-eSATA internal cable was used to connect to the non-eSATA controller.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Maxim S. Shatskih” wrote in message
news:xxxxx@ntfsd…
>>How can I identify an eSATA drive as a Removable media/drive ?
>
> On pre-Win7, you just plain cannot.

Maybe by “optimize for fast removal” setting?
– pa

> And even on Win7 you cannot, if the SATA-to-eSATA internal cable was used
> to connect to the non-eSATA controller.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>

Interesting.
So how does the OS on WinXP and Vista/Win7 detect that the eSATA drive is removable, can I cannot use the same method in my minifilter ?

Can you elaborate more on the “optimize for fast removal” setting?

Also what would be the method on Win7 if its connected to an eSATA contoller, which I believe would be unlikly.

Thanks,
SS

> So how does the OS on WinXP and Vista/Win7 detect that the eSATA drive is removable

It does not detect this at all pre-Win7.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

I see what you mean. WinXP does not provide an option to safely remove the device.

On Win7 I have this option. So how can I detect it on Win7 ?
It’s fine if I can’t determine it as eSATA, all I need is a way to figure out that it’s a removable device.

Thanks,
SS

query and check: STORAGE_DEVICE_DESCRIPTOR. This may help you.

http://msdn.microsoft.com/en-us/library/ff566971(VS.85).aspx

On Win7 the IOCTL_STORAGE_QUERY_PROPERY for eSATA returns the RemovableMedia as FALSE and the BusType as RAID.

I tried this for a USB device, the Removabl Media was FALSE, while the BusType was USB.

So I can’t determine an eSATA as removable media using this.

Any other suggestions ?

Just curious, Is it an intel controller in RAID mode (with intel port driver)?

That IOCTL is telling you whether the media is removable. It isn’t because SSD media cannot be ejected from the device. What you really want to do in this case is check whether the device is removable.

>> What you really want to do in this case is check whether the device is removable.

How do I do this ?

I have already tried the IOCTL_STORAGE_GET_HOTPLUG_INFO. Is there another IOCTL ?

I see that in device manager, the “Safe Removal Required” property is set to TRUE for my disk.
Is there a way I could query this in the mini filter ?

Thanks,
SS

>> Is it an intel controller in RAID mode

Yes it’s an Intel SATA RAID contoller

Have you looked at the utility libraries from the HBA manufacturer? For instance, using the LSI provided software and libraries for MegaRaid and 3Ware, from user mode, you can interrogate a given device for any piece of information that you want.

Gary G. Little

----- Original Message -----
From: “sarin sumit”
To: “Windows File Systems Devs Interest List”
Sent: Wednesday, March 30, 2011 2:01:49 AM
Subject: RE:[ntfsd] How to detect an eSATA drive

>> What you really want to do in this case is check whether the device is removable.

How do I do this ?

I have already tried the IOCTL_STORAGE_GET_HOTPLUG_INFO. Is there another IOCTL ?

I see that in device manager, the “Safe Removal Required” property is set to TRUE for my disk.
Is there a way I could query this in the mini filter ?

Thanks,
SS


NTFSD is sponsored by OSR

For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>> Have you looked at the utility libraries from the HBA manufacturer…

I need a solution using native OS. Cannot depend on third party libraries.

My my, now THAT is a succinct answer. Why? Actually, that’s to bad.

I’m currently working on a diagnostic application that provides full control of all RAIDs in Server 2003, including performing diagnostic testing, starting/stopping, and removing/inserting individual disks within an array, and ALL of this from user mode. I’m just beginning the task, but already I’ve determined everything you’ve been asking for by simply sending requests to a MegaRAID controller using the supplied software development kit provided by the HBA OEM. The point is that using such resources is a cheap way to have more control over storage than relying on what is provided by this mythical “native OS” .

Gary G. Little

----- Original Message -----
From: “sarin sumit”
To: “Windows File Systems Devs Interest List”
Sent: Thursday, March 31, 2011 12:04:15 AM
Subject: RE:[ntfsd] How to detect an eSATA drive

>> Have you looked at the utility libraries from the HBA manufacturer…

I need a solution using native OS. Cannot depend on third party libraries.


NTFSD is sponsored by OSR

For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

DEVICE_CAPABILITIES->Removable flag indicates if the device is removable. http://msdn.microsoft.com/en-us/library/ff543095.aspx

On my machine with intel controller/driver and e-sata drive this flag is set. May be somehow you can use this.