"Ejecting" SATA drive (mass storage device, NOT USB) using script

G

Guest

I have used many tools:

deveject
devcon
removedrive
sync

all seem to work with USB drives but will not work properly with Mass
storage devices of the hard drive kind (SATA) that isn't USB.

I know the Eject Devices GUI, but i want to run this through script.

Is there any way of achieving this, or has MS made windows inccappable of
doing so? (seems kinda silly to me)

Thanks you for all responses
 
D

DL

Perhaps it depends on the controler your sata drive is connected to.
I know if I connect a sata drive to one of my other sata controlers its then
detected as a removable device, with the resulting icon/stop device
available.
(My mobo has a Sil and Nvidea sata controller, it was the Nvidea controller
that then showed as removable)
 
U

Uwe Sieber

Jake1980 said:
I have used many tools:

deveject
devcon
removedrive
sync

all seem to work with USB drives but will not work properly with Mass
storage devices of the hard drive kind (SATA) that isn't USB.

I know the Eject Devices GUI, but i want to run this through script.

Does it mean that you can reattach it when it's removed
thru the 'save removal' GUI?

Have you tried a 'devcon rescan' after reattaching the
SATA drive?


Greetings from Germany

Uwe
 
G

Guest

To answer DL: I think all SATA drives are considered removable to the OS.
That is the design spec of SATA.

Uwe Sieber: I have not used devcon rescan, i beleive what it does after i
attach it is that it shows up in the Manager but is unusable.

The computer needs a restart in order to use that volume. It doesn't get a
drive letter. It shoulds up in the GUI but i cannot use it.

All the tools i mentioned work with USB fine, it's with these removable mass
storage devices with SATA that all these utilities seem to "remove" it and
not "UNPLUG" it.

Only the Safely Remove Hardware GUI has the Eject feature that is required.

I need EJECT. Not REMOVE.

Devcon has a import/enable, but then what i'm doing is blocking the drive
and making it unusable; then reversing it. I still need to restart
afterwards to make the volume show up.

Thanks for all the responses.

Maybe this feature will be corrected in Vista?

The point would be to Truly do Hot Swap of Hard drives without a Raid array,
use JBODs and swap them like USB flash disks.
 
U

Uwe Sieber

Jake1980 said:
Only the Safely Remove Hardware GUI has the Eject feature that is required.

I need EJECT. Not REMOVE.

Don't pay to much attention to these terms...


I think I've found the problem. RemoveDrive removes the
volume only but not the drive itself.

When you execute RemoveDrive it shows the device name
that it ejects. But this is output is true only for
USB drives that are removable.

But you can grab the name and run RemoveDrive again
with this device name as parameter, e.g.

Removing Drive T:\ (FUJITSU MHK2120AT SATA Device)
success

then call
RemoveDrive "FUJITSU MHK2120AT SATA Device"

The problem here is, that there is no warrenty that
there is no second device with exactely the same
name. Then it's pure chance which one is logged of.

So far I've not found the missing link between volumes
on SATA drives and their drive. But I'm searching...


Greeting from Germany

Uwe
 
U

Uwe Sieber

But you can grab the name and run RemoveDrive again
with this device name as parameter, e.g.

Removing Drive T:\ (FUJITSU MHK2120AT SATA Device)
success

then call
RemoveDrive "FUJITSU MHK2120AT SATA Device"

Correction: RemoveDrive constructs the device name
by putting together vendor name, device name and
the bus type name. The latter one I had guessed and
now it seems to be ok for USB only ('USB device').
There seems to be no bus type text for ATA or SATA
drives, so please try
RemoveDrive "FUJITSU MHK2120AT" even it shows
Removing Drive T:\ (FUJITSU MHK2120AT ATA device)
before.

Can someone tell me if SCSI and 1394 devices appear
with a trailing 'SCSI device'/'1394 device' or not
in the 'save removal' dialog? Thanks.


Greetings from Germany

Uwe
 
G

Guest

Uwe:

thanks for your involvement in this.

using deveject, i have this data shown for my two hard drives:

'Maxtor 6 B300S0 SCSI Disk Device'
'SCSI\DISK&VEN_MAXTOR_6&PROD_B300S0&REV_ABCN\
5&38DB3D1E&0&000' [REMOVEABLE]

'Maxtor 6 B300S0 SCSI Disk Device'
'SCSI\DISK&VEN_MAXTOR_6&PROD_B300S0&REV_ABCN\
5&38DB3D1E&0&040' [REMOVEABLE]

First one is F: and the second one is G:

I would like to use the cmd line script to eject each one like every other 2
days.

testing with your program Removedrive.....

removedrive f: [Removes just the volume but not the drive. Restart is
needed to gain access again]

removedrive "Maxtor 6 B300S0 SCSI Disk Device" [Pickes out the first one
(F:) and actually shows it being ejected!!!! BUT since both disks are named
that way, i can't choose which one i want.]

this is getting closer, since both drives won't need to be in at the same
time ever, this script could be effiecent once tweaked and a process is done
to switch out the drives. Though it's not perfect, it's near close that
though.

Hopefully you can figure out if you can mix drive letter and name. or maybe
i can change the "name" to something else so that this program and
distinguish between the two.

Hope this helps!

Jake
 
U

Uwe Sieber

Jake1980 said:
testing with your program Removedrive.....

removedrive f: [Removes just the volume but not the drive. Restart is
needed to gain access again]

removedrive "Maxtor 6 B300S0 SCSI Disk Device" [Pickes out the first one
(F:) and actually shows it being ejected!!!! BUT since both disks are named
that way, i can't choose which one i want.]

Great, you have two identical named disks. You are the
perfect tester :)
I think I've figured out how to match between volumes and
their disks...

Here is RemoveDrive 0.9:
http://www.uwe-sieber.de/files/removedrive09.zip

Please let me know if it works.


Greetings from Germany

Uwe
 
G

Guest

Uwe:

Glad to help!

as for the link, it keeps giving me version 7, the url tries for 9 but
swtiches to 07 to download.

I will wait till later this afternoon, about 3 hours from this post and try
again to download it.

Thanks!

PS: I assume you want me to test just the drive removal by drive letter
since using the device name alwasy picks the first one, or drive F: ? Note:
these are two seperate disks, not two partitions on same hard drive.

Uwe Sieber said:
testing with your program Removedrive.....

removedrive f: [Removes just the volume but not the drive. Restart is
needed to gain access again]

removedrive "Maxtor 6 B300S0 SCSI Disk Device" [Pickes out the first one
(F:) and actually shows it being ejected!!!! BUT since both disks are named
that way, i can't choose which one i want.]

Great, you have two identical named disks. You are the
perfect tester :)
I think I've figured out how to match between volumes and
their disks...

Here is RemoveDrive 0.9:
http://www.uwe-sieber.de/files/removedrive09.zip

Please let me know if it works.


Greetings from Germany

Uwe
 
G

Guest

Uwe:

I had ran the tool and it had successfully removed the drive [removedrive
G:], not just the partition, and changed the status on my SATA enclosure to
red, which means disconnected, as if i did the GUI Safely Remove Hardware.

But...

I took out the drive, and slide the drive back in. the drive initialized
and the device was added to the Device Manager. The volume was there in Disk
Management, but it was not reading the partition right. It was showing it
with NO drive letter, and showing 100% free, which it really is about 70%
full, thus show 30% free if it was reading right. There isn't a drive G:
obviously so a restart is neccessary. After a restart, everything is ok.

I think it's getting really close, but am unsure if there can be more to be
done.

This may work for us with a restart command at set intervals to makes sure
the other drive is there and working for that night, and just do a hop skip
and jump in the morning to switch drives.

OR there is that deveject command that could refresh the partitions so that
at a set interval the script would run, we would eject one drive and slide
the other drive in, then the deveject command script would run after. We'd
probably have to set it to set times... 9am remove drive, 9-10am swap HDs,
10am deveject refresh partition.

of course this still is a bit of work but it's far closer to what we wanted
than of when we started!

Thanks Uwe for your work, if you want to test anything else, let me know!

Hopefully they do something different with Vista.

Jake
 
U

Uwe Sieber

Jake1980 said:
I had ran the tool and it had successfully removed the drive [removedrive
G:], not just the partition, and changed the status on my SATA enclosure to
red, which means disconnected, as if i did the GUI Safely Remove Hardware.

But...

I took out the drive, and slide the drive back in. the drive initialized
and the device was added to the Device Manager. The volume was there in Disk
Management, but it was not reading the partition right. It was showing it
with NO drive letter, and showing 100% free, which it really is about 70%
full, thus show 30% free if it was reading right. There isn't a drive G:
obviously so a restart is neccessary. After a restart, everything is ok.

To be sure I have to ask again... If you prepare the SATA drive
thru the 'save removal' GUI, then you can successfully re-attach
it?

Maybe RemoveDrive still not removes the correct device.
For USB drives it doesn't removes the disk, it removes
the USB bridge that is above it in the device tree.
Maybe there is a device above SATA drives too. Unfortunally
I don't have one...

Could you send me please the results of this tool?
http://www.uwe-sieber.de/files/listdevices.zip
Started thru the ListDevices2txt.cmd it writes a
text file and opens it in notepad.
The result file is too large for posting - please send
it to my eMail address.
Thanks.


Greetings from Germany

Uwe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top