Jump to content
wwwolf

Eject USB Hard Drive After Snapshot Transfer

Recommended Posts

Does anyone know a good way to automaticly eject a USB hard drive after the transfer to it is complete?

 

I used to use a small commandline tool and batch script that Retrospect would run after every job. That worked fine on my old Windows XP backup box, but doesn't seem to function with my new Windows 7 setup – it never releases the drive.

 

Anybody have a solution to this in their own setup?

  • Like 1

Share this post


Link to post
Share on other sites

You could try devcon.exe. I use it to detach a removable SATA drive that has ST3500 in its name:

devcon find ST3500*
devcon disable ST3500*
devcon remove ST3500*

You may have to run as administrator, and I find I have to close Retrospect first to release its file handles or the removal says I need to restart.
 

There is also RemoveDrive mentioned in this thread which i have used for USB drives, although it too can get stuck when a program hasn't released the drive or file/folder.

Edited by rsleegers

Share this post


Link to post
Share on other sites

Thanks for the suggestion, rsleegers!

 

I think I'm on the right track, but changes in the security model (and the addition of UAC) in Windows 7 is causing me headaches.

 

I've managed to dig up my old retroeventhandler.vbs script. I'm not sure why the example scripts don't appear to be included in Retrospect 10, but they are still called.

 

The long story short is that I have a line that calls:

WshShell.Run """C:\Program Files\RemoveDrive\RemoveDrive"" e:"

 

The request executes, but RemoveDrive fails to eject the drive. So far my testing has shown that I can reproduce this error when I launch the script as a normal user, but an elevated user executes as it should. This is particularly confusing as Retrospect runs as an elevated user, so I'd expect it to launch its scripts as such.

 

 

In any event, I've given up doing it the fancy way for the moment and just placed the call to RemoveDrive as a scheduled task. My backups are predictable enough that should work for now.

Share this post


Link to post
Share on other sites

If you enable the 'Quick Removal' option for the USB drive (not having a USB drive to hand can't say exactly where the setting is) you should be able to unplug the drive without first having to eject it. By default this option is disabled to improve write performance hence the usual need to eject the drive to clear the write cache.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×