-1

Sometimes, when trying to eject (remove) an external USB hard drive, Windows 7 issues the following error:

Problem Ejecting USB Mass Storage Device

Windows can't stop your 'Generic volume' device because a program is still using it. Close any programs that might be using the device, and then try again later.

This question addresses this issue when it happens in Windows XP or Windows Vista. Are there better techniques to use in Windows 7 SP1, preferably something that does not require a closed-source third-party tool?

Things I have tried:

  • Closing all applications.
  • Letting the system sit for 5 minutes to finish any outstanding NTFS journal writes.
  • Disabling Windows indexing.
  • Ensuring that there are no shares.
  • Temporarily disabling antivirus.
  • Using USB Disk Ejector (did not help).
  • Putting the system in sleep mode and then waking it up.
  • Using SysInternal's Process Explorer to see if any processes are using the drive.

My technique in the past was to turn off the system, but chkdsk often detects errors after doing this.

  • First you need to know what exactly causes the problem. Start sysinternals process explorer and do a search your usb hdd drive letter (for example: `f:` ). Which processes use the drive? https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx – Jack White Jul 20 '16 at 23:55
  • Thanks Jack. Process Explorer turned up nothing using it. – RockPaperLz- Mask it or Casket Jul 21 '16 at 01:38
  • Completely killing and restarting Windows Explorer always does the trick for me. On the rare occasion that it does not, logging off and then logging back on will take care of it (no restart required) – InterLinked Jul 21 '16 at 01:40
  • @InterLinked Thanks! Next time it happens, I will try both of those suggestions. Would you like to turn your comment into an answer, or would you prefer I create an answer with those tips? – RockPaperLz- Mask it or Casket Jul 21 '16 at 02:24
  • I forgot to tell you to run Process Explorer by right-clicking the downloaded file and selecting `Run as administrator`. Please launch it like that and try searching again. – Jack White Jul 21 '16 at 11:39
  • If process explorer still reveals nothing, please open the start menu, right click `Computer`, select `Manage`, to the left of the window select `System tools -> Event viewer -> Windows Logs -> System` and see if a warning event ID `225` from `Kernel-PnP` showed up recently saying `(something) stopped the removal or ejection for the device (something)`. If it does, please find the offending process by matching its `process id` to `PID` column of Process Explorer, and tell us what it is. – Jack White Jul 21 '16 at 11:52
  • @JackWhite Thanks. The next time it happens, I will do exactly that. – RockPaperLz- Mask it or Casket Jul 21 '16 at 19:44
  • @JackWhite Ironically, it has not happened in the last two weeks. – RockPaperLz- Mask it or Casket Aug 05 '16 at 21:16

1 Answers1

1

Here are some steps you can take:

  1. Completely restart Windows Explorer. To do this, press WIN+Shift+Esc to open Task Manager. Then, locate explorer.exe in Details and kill the process. Click New Task, type 'explorer' and hit Enter. Alternatively on Windows 10, you can also try right-clicking Windows Explorer on the processes tab and clicking Restart
  2. Try closing the application that was using the USB. Somtimes, if I edit a file in Word on a flash drive and then start doing something else in Word, completely closing Word will free it up for whatever reason.
  3. If the above does not work, try logging off and then logging back on. This is a last-resort but it most certainly will work. No restart is nessecary. Be careful about restarting with a USB in - if your PC is set to boot from USB, you will get a No OS detected error
InterLinked
  • 2,406
  • 6
  • 29
  • 64
  • It is worth adding that a program having current directory pointed to the USB drive will cause this. For some programs like total commander it is obvious where the current directory is. For some others like word or photoshop it is not - but often it is the directory from/to which a file was last opened/saved manually by using "Open file" or "Save as" dialog window. If you were working with a file on the USB in some program try manually opening a file from your c:\ to reset the current directory. – Jack White Jul 21 '16 at 11:13
  • @JackWhite Will closing the program work just as well? – RockPaperLz- Mask it or Casket Jul 21 '16 at 19:42
  • Is it best to kill Windows Explorer using `End Process` or `End Process Tree`? – RockPaperLz- Mask it or Casket Jul 21 '16 at 19:43
  • Yes, closing the program will work for sure in this case - what is outlined in this answer is enough. My point is that very often it is not necessary to close all the programs that might be responsible - just changing active directory is enough - even closing files opened from the USB is not always required (unless the file is locked like Word and Excel do). – Jack White Jul 21 '16 at 22:47
  • Do NOT use `End Process Tree` on Windows Explorer - doing so will most likely terminate all programs running in your session. – Jack White Jul 21 '16 at 22:50
  • @JackWhite I noticed no difference between End Process and End Process Tree when terminating, well anything, including explorer.exe No harm in terminating Explorer, I'm sure of that – InterLinked Jul 22 '16 at 10:06
  • `End Process Tree` additionally terminates all the programs that were launched by selected program. Few programs run other ones normally since they don't need to. However `Explorer.exe` is an exception - it represents the desktop, Start menu, and all folder windows. Unless you use custom launcher, shell, or file-manager software (like total commander and some desktop widgets), almost all programs are launched by `Explorer.exe`. If you did not start those programs, terminate `Explorer` and restart it earlier, chances are it's `Process Tree` will include every one of your running programs. – Jack White Jul 22 '16 at 12:55
  • OK. That's never happened to me before, but I can understand the concern. – InterLinked Jul 22 '16 at 14:00
  • Correction: even if you use a custom file manager/shell, that file manager/shell itself is most likely launched via Exlorer's shortcut or Startup folder, so tree-killing Explorer would terminate those as well if the file manager/shell that launched them is still running. Probably only exceptions to the rule would be programs that were launched through previously closed other programs, those scheduled through task scheduler, services and anything manually launched via task manager plus the task manager itself – Jack White Jul 23 '16 at 11:46