The unsafe device removal dialog

In a comment, somebody asked what the deal was with the unsafe device removal dialog in Windows 2000 and why it's gone in Windows XP.

I wasn't involved with that dialog, but here's what I remember: The device was indeed removed unsafely. If it was a USB storage device, for example, there may have been unflushed I/O buffers. If it were a printer, there may have been an active print job. The USB stack doesn't know for sure (those are concepts at a higher layer that the stack doesn't know about) - all it knows is that it had an active channel with the device and now the device is gone, so it gets upset and yells at you.

In Windows XP, it still gets upset but it now keeps its mouth shut. You're now on your honor not to rip out your USB drive before waiting two seconds for all I/O to flush, not to unplug your printer while a job is printing, etc. If you do, then your drive gets corrupted / print job is lost / etc. and you're on your own.

Comments (27)
  1. anon says:

    Great blog, Raymond! Keep up the good work!

    Anyway,I wanted to ask someone in Microsoft this question (maybe this is not the most appropriate place to ask, but I’ll put it out there anyway):

    Is there any way to print out Unicode characters (meaning the whole supported range in Windows instead of just a code page subset like Japanese or ASCII) in the command prompt? I guess, the question should be, is there a Unicode code page I could set to allow it to intrepret my bits and bytes as Unicode characters?

    I know can do this with a GUI. But I want it on the command prompt because it’s useful. For example, a command line SQL processor may need to display NCHAR Unicode characters as a result of a SQL query.

  2. Raymond Chen says:

    I don’t know the answer to this one.

  3. anon says:

    anyway to get windows xp to notify you the same windows 2000 did?

  4. Dan Maas says:

    I wonder if the USB or FireWire designers gave any thought to preventing forced removal. (like the old Macintosh floppy drives that had no manual "eject" button, to prevent you from ejecting a disk while in use). Perhaps some kind of latch or indicator light to say "don’t remove this device!"

    This is particularly critical with disks – how can you be sure *all* buffered I/O has been flushed? Computer geeks understand this but I’ll bet lots of naive users will end up corrupting their disks by pulling the cable at bad times.

    Maybe you could have a battery-backed RAM cache on the disk, then force the OS to commit all writes synchronously. Writes would go into RAM quickly, and if someone pulls the plug, a battery provides enough power to make sure everything is written.

  5. Karan Mehra says:

    On Windows XP, there will be an entry from PlugPlay in the System event log.

  6. Claw says:

    Just curious… why was this decision made in the first place? Don’t you want to yell at the user so they won’t do it again in the future? With the way it is now, they’ll continue to unplug their device unsafely and then one day find themselves with a corrupted disk and not know the reason why.

  7. Raymond Chen says:

    My guess: Because the message was annoying and 99% of the time the removal was harmless anyway. I kind of miss it myself.

  8. lejordet says:

    I always found the 2000 "yelling message" quite annoying… It popped up every time I disconnected my digicam, even if I hadn’t copied anything to/from the cam, and every time I disconnected my USB network adapter (which I, of course, couldn’t care less if were active when I ripped it out ;)

  9. Claw says:

    Well, in that case, Windows XP should just use one of those "balloon tooltips" to tell you that you removed a device unsafely. It’s not as annoying as the dialog box that pops up in 2000 since you can just ignore it and continue to work if you’d like. Plus, users at least would have a hint as to why their removable disk got corrupted in such an event.

  10. Me says:

    I read somewhere, that XP disables Write-Buffering for USB-Devices because users like to rip the device out without remove dialog

  11. asdf says:

    Balloon tooltips are pretty annoying. Every time I unplug my ethernet cable out it puts an X over the network icon AND shows the ballon tip. The X is sufficient and I’m tempted to use softice to rip that function call out.

  12. Jonathan Perret says:

    Try this in a console window :

    C:> chcp 65001

    This puts the console in the UTF-8 "codepage".

    I’ve just tried it and it allows console applications to print any Unicode character the current console font supports. Unfortunately the default, Lucida Console, does not support a lot of characters beside Greek and Cyrillic; and the standard CJK fonts can’t be used as console fonts.

  13. Jonathan Perret says:

    Back in the day of floppy disks (on a PC at least) the user had the same responsibility of making sure the system was done writing on the disk before ejecting it. The system for its part was expected to use the floppy in predictable ways, i.e. disable write caching.

  14. Scott says:

    I figure they removed it because it was a weird concept. "You just did something bad, and it’s too late now to fix it and your data might be hosed, but here’s some suggestions for the next time you do this."

  15. dannyman says:

    Well, since Windows is actually a giant web browser, couldn’t they have just added one of those checkboxen to the original dialog "Do not show me this warning again?"

    Then, you are warned, and if you don’t like being warned, you can say so.


  16. James says:

    I have also heard that XP disables write-behind caching on removable devices. Is there any way to get 2000 to behave the same?

    I have a CF reader, and for some wacky reason Windows 2000 won’t let me disable write-behind caching on that device. If I don’t stop the device via the Unplug/Eject Hardware dialog, I lose data. If I stop the device, I physically need to disconnect the card reader and connect it back if I want to insert a new card. Ugh.

  17. Jim Adams says:

    Here’s one that has puzzled me…. What happened to QuickView in XP? That used to be a great way to look at DLL entry points. Now I have to write my own program to dump them out.

  18. Junfeng says:


    You can use CJK fonts as console fonts. You need to set one of them to be the default non-unicode language in regional and language options.

  19. mph says:

    I am curious if Eject from removable drive context menu avoiding this problem?

  20. BTannenbaum says:

    RE: QuickView

    What’s wrong with dumpbin /exports? Or you can download Depends

  21. > You’re now on your honor not to rip out your

    > USB drive before waiting two seconds for all

    > I/O to flush,

    Sometimes it takes longer than two seconds. When I want to detach a USB hard disk, I do click on that icon in the notification area and ask for permission. About 90% of the time it gives permission, about 10% of the time it waits and then refuses. I think the length of time it waits is about two seconds, and that’s after the amount of time I already waited.

    If it’s a USB DVD drive without media in the drive, or a modem or LAN adapter or anything else like that, then I’ve been known on occasion to charge ahead and detach the device.

    12/17/2003 10:09 AM Scott:

    > I figure they removed it because it was a

    > weird concept. "You just did something bad,

    > and it’s too late now to fix it and your

    > data might be hosed, but here’s some

    > suggestions for the next time you do this."

    Yeah, educating users on how to avoid repeating problems is a weird concept. (I hope you don’t really believe that, but it seems that we know a famous company who operates that way.)

    Another weird concept involved here is that this alerts the user to the need to reattach the device, do a scandisk, and re-copy any files to the drive that were detected as corrupt. What’s this, someone who wants their backups to be really usable for making restores from when the need arises? That’s weird all right. Sigh.

  22. a-ran says:

    Is there no way to get rid of the "unsafe removal…" dialogue in win2k?

  23. SloppyGoat says:

    Yes! That’s what I’m looking for! I want to get rid of that dialogue and tray icon forever! It’s a huge unnecessary annoyance, IMO.

  24. colind4 says:

    This is frustrating the hell out of me! Every time I turn off my HP all-in-one, I get that *#^@#&** dialogue box. However, I don’t get the tray icon, so I can’t shut it down "safely"! I’ve been emailing back and forth with tech support for 3 days and they’ve quit on trying to solve the problem.They do say that it’s OK to click on OK and continue working, but from what I’ve read here today, maybe that’s not a good idea. It’s all I can do for now, though, unless someone can come up with a better idea.

  25. Raymond Chen says:

    Commenting for this article has been closed.

Comments are closed.

Skip to main content