Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows 2003 server machine, this machine is backed up by a nightly scheduled task that copies files and folders to a portable USB hard drive (encrypted using TrueCrypt)

Every week the portable drive is takes off-site and another drive is connected (we currently rotate between 2 portable drives).

The problem is that every week when we rotate the drives we can't dismount the connected drive because of some random file or folder that is open, the process holding the file open is always explorer.exe.

If I close the handle by using ProcessExplorer everything works - the volume is dismounted cleanly and explorer continues to work normally.

I want to know how to stop explorer from keeping the file open in the first place, I suspect some 3rd party code that is loaded into explorer is the problem but I don't know how to track it down.

This is a production server, so installing debugging tools or doing anything that will take the server off-line for more than a few minutes is not acceptable.

Thanks

EDIT: Thank you for suggesting unlocker but I want to prevent getting into the locked file situation in the first place, this is a production server and I don't want mess up the explorer process.

Another Edit Is you want to know why I don't want unloacking tools just read this http://technet.microsoft.com/en-us/magazine/2009.04.windowsconfidential.aspx

share|improve this question
add comment

5 Answers

Use unlocker. First unlock your root drive using Sent to --> unlock then you will be able to remove it easily. It won't make your server unavailable and it is a very small utility. I am working with it on Win 2003 perfectly.

share|improve this answer
    
Kick-ass tool I've been using for a long time now –  Scoregraphic May 31 '09 at 10:27
    
I was about to ask the question "Does unlocker work with other processes" but the answer is "Of course" as I've used to force IIS worker process to let go of a folder without iisreset. –  Rob Nicholson May 31 '09 at 13:43
add comment

Change explorer.exe's focus onto a folder of another partition.

share|improve this answer
    
what the... it worked!? That's so incredibly strange... –  Mooing Duck Apr 22 at 19:57
add comment

Sometimes the Windows Indexing Service starts working on the file system and in the process locks the files.

This RemoveDrive tool supports stopping the service for a short while to remove the USB drive. This has worked quite well for me.

RemoveDrive DriveSpec: [-l][-h][-b][-i][-s][-w:nnnn]

DriveSpec: is the drive to remove, e.g. U: or \ for the current drive
[-L] loop until success
[-h] show open handles (admin rights required, exprimental, may freeze!)
[-w:nnnn]  wait nnnn milliseconds before close
[-s] self delete removedrive.exe
[-b] let Windows show the "Safe To Remove Hardware" balloon tip
[-i] stop Windows indexing service (CiSvc) for a moment 
     if required (admins)
[-d] show debug information


Generic notes.

  • The drivetools page is in general a very good reference for USB related points
  • Microsoft Indexing Service is notorious for processor hogging and in some cases also pagefile fragmentation. You might want to read up some more and consider selectively stopping it recursively over specific folders (right click, properties, General, Advanced).
  • Sysinternals PageDefrag is a good tool to check page file fragmentation and defragment the same (requires a reboot)
share|improve this answer
add comment

If you suspect an explorer addon, try shexview, which can list and disable them for you. You will have to kill & restart all explorer.exe processes for it to take effect, though.

On the other hand, on a server you might just disable all of them, since who needs PDF preview in Explorer and similar things on a server?

share|improve this answer
add comment

Are you dismounting Truecrypt first? More than likely it's itself Truecrypt that is preventing the dismount. It will appear to be Explorer because of the way the Truecrypt service works.

share|improve this answer
    
I get the error when I'm dismounting TrueCrypt, not when I'm disconnecting the physical drive –  Nir Jul 8 '09 at 7:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.