Summary: Windows tries to prevent corruption by disallowing removal of USB devices that are "in use". Unfortunately it's not always obvious what "in use" means.
Whenever I plug in a flash drive or my external hard drive (Western Digital My Book), I cannot safely remove when I click on the icon. I keep getting the message that the drive is currently in use -- try again later. But, no matter how many times I try, I keep getting the same message. I end up having to shut down my computer to remove the device.
•
Well, windows certainly thinks that some program is attempting to access the USB drive. Since it's not guaranteed to be safe to remove a drive while it's in use, Windows tells you that you can't. The "wait until later" part is all about waiting until that program, whatever it is, is done with the drive.
What program?
Figuring that out is the trick...
•
Here's the message we're talking about:

This pops up if you attempt to "safely remove hardware" on an external USB flash or hard drive and Windows thinks that the drive is in-use by some program on your machine.
It turns out that finding out what program that might be isn't particularly obvious, but we can go searching for clues.
Here's the approach I use.
First, go download and run Process Explorer - the free Sysinternals utility from Microsoft.
With Process Explorer running, use its Find menu, Find handle or DLL ... function, and search for \device\harddisk. You should get results similar to this:

You can see that the list includes several entries (yours will almost certainly be different). And it's not at all obvious which hard disk each line represents. However clues are here.
In my case I looked down this list and realized that WS_10001.WMA, listed in the right hand column, is an audio file that I was just listening to. I had failed to close the audio player (mplayerc.exe, listed in the left hand column). I closed the player, and "Safely Remove Hardware" worked just fine.
It's difficult to predict what you'll find that might have something open on your external drive. In my case it was simple, I'd been listening to an audio file that I immediately recognized. The clues you get might not be quite as obvious. In particular, check the list of programs you'll see on the right of your own search results list. See if any of those might have a reason to be accessing the USB drive.
I'm guessing that some of the unexpected offenders you might find in that list include anti-virus programs who've started scanning the drive, anti-spyware tools doing the same, the Windows indexing service (you might need to turn off indexing of the external drive) and other tools that might try to automatically access hard drives that are found on your system.
Related:
Ask Leo! - Is there a way to "Safely Remove Hardware" from a batch file?
Ask Leo! - Safely Remove Hardware: where did the icon go? How do I safely remove hardware without it?
Ask Leo! - Why won't my system recognize my USB device?
Article C3246 - December 23, 2007
I frequently have .doc files on a USB drive that I may have been editing. I use Word as my default editor for Outlook, also. I have found that I have to close Outlook in order for the "Safe to remove..." message returns. It took me awhile to find that one.
Posted by: Bill Holland at December 29, 2007 10:59 AMThanx Leo It was very good article.Now I am able to resolved the problem that I ever face.
Posted by: ashoka at January 1, 2008 6:07 AMre: using "unhooker" to close any handles on the removeable drive: Just r-click on the drive in explorer, unhooker shows, select it, and select close handles. cant find this and cant unplug my WD external drive. thanks 4 the help! Susan
Posted by: susan b at January 17, 2008 8:32 AMAlso there is another way of getting rid of this problem without any additional cliks - to use USB Safely Remove ( http://safelyremove.com ). It fully replaces native safely remove utility and allows to displays programs are locking the device. It's not free, but it's very handy when you use USB gadgets often
Posted by: WiseJoe at January 22, 2008 10:18 AMclosing outlook took care of the problem for me. I had sent an attachment from my usb drive and though e mail had been sent, I was still getting the "cannot be stopped error"
Posted by: Brian Bozwick at December 3, 2008 8:08 AMIf you are in Vista you can use the inbuilt Resource monitor to check what is accessing the disk. Resource Monitor actually lists the drive letter so it is a little easier to identify the correct disk if you have many drives.
However I am not sure if it is present in all the flavors of Vista.
Posted by: Wizzardofoz at December 24, 2008 7:11 PMTo unhook whatever is accessing your device, simply create a new folder anywhere, cut it and paste it in your recycle bin then emty your recycle bin.
Posted by: ray at January 9, 2009 11:42 PMnow you should be able to safely unplug your device
Why, after so many years and so many versions of Windows, does Windows still do this? What SHOULD happen when the user selects a device to Safely Remove is Windows should AUTOMATICALLY and QUIETLY close all open file handles and flush all pending writes to the drive, then pop up the OK box. If for some reason it thinks some file is still open, it should present a list to the user. If the user knows nothing on the drive is in use, there should be a button to smack Windows upside the head. If the drive happens to be open in Windows Explorer, Windows should simply and QUIETLY move to C: or somewhere else WITHOUT COMPLAINING, just like it does when you eject a CD while looking at it with Windows Explorer.
Why, after all this time, does Windows not behave in this logical manner? Will the current dumb behavior be perpetuated in Windows 7?
Posted by: Galane at January 15, 2009 12:41 AMThe drive may also be optimized for quick removal as opposed to performance in the device manager. If you check it in the list of drives you can change the option with a restart required.
Posted by: Robert at February 19, 2009 8:06 PMI am having this problem right now. I wish there was a way to know which disk is which (\Device\HarddiskN etc.). However, the drive properties in Device Manager say that it's optimized for quick removal and "this setting disables write caching on the disk and in Windows, so you can disconnect this device without using the Safe Removal icon." I am just going to do that, by lack of an alternative. It is empty right now anyway, I just formatted it and wiped it with PGP Shredder to eliminate malware that often comes with new flash disks.
Question: doesn't the error occur simply because of the "quick removal" setting, meaning Windows has no cache to flush and can't "remove" something that is already not permanently attached?
Posted by: Urso BR at May 9, 2009 9:40 PM