I see people unplug a USB e.g. External drive from the port without flagging/ejecting it from the OS first. What are the risks in disconnecting a USB device in the middle of a transfer? Could it damage my hub controller, or blow-up my motherboard or such?

  • 2
    \$\begingroup\$ According to USB standard, all devices must be plug and play and host needs to survive short between any lines. If the device is standard compliant, there must not be any hardware damage at all. The problem with safe remove is that for example file system on a flash drive may be left in bad state or a program using the device may crash (this happened to me with sound cards for example) and so on. \$\endgroup\$ – AndrejaKo Dec 29 '11 at 17:26
  • \$\begingroup\$ Forgive me if this is pedantic, but is 'plug-and-play' commutative apropos 'unplug'? I'm thinking whether it would be safe to connect an RS232-USB adapter to a USB port whilst the RS232 receives input from, say, a CW receiver; dare not experiment with it lest it blows up the m/b |+: \$\endgroup\$ – Everyone Dec 29 '11 at 17:41
  • 1
    \$\begingroup\$ This sounds like a superuser question to me. \$\endgroup\$ – Kellenjb Dec 29 '11 at 18:56
  • \$\begingroup\$ Let's try to keep this focused on the low-level implementation issues, rather than high-level usb-drive, motherboard, and Windows 7 issues. That is already addressed at Superuser; see Should I unmount a USB drive before unplugging it? and How to swap non-memory usb devices? for answers to that question. Chris mentioned that an always-unsafe drive could be built; how about an always-safe drive? \$\endgroup\$ – Kevin Vermeer Dec 29 '11 at 19:01
  • \$\begingroup\$ @KevinVermeer I do not believe that was the intent of his question at all. There is nothing in the question that shows of sign of caring how it works, rather only what could happen from a consumer point of view. \$\endgroup\$ – Kellenjb Dec 29 '11 at 20:10

USB is intended to be electrically hot-pluggable, so the issue is actually one of software state rather than at the hardware level.

Essentially, the concern is that a mounted file system could have uncommitted buffers in ram at the time when the device is unplugged, or could be in the middle of some interruption-unsafe move operation or meta-data modification. Journaling file systems can provide some protection against this if well thought out (or make an even more hopelessly confused mess if badly designed). Further questions about that aspect of the issue would probably belong on superuser.

It would certainly be possible to (accidentally?) design a USB flash controller IC which conducted interruption-unsafe housekeeping operations below the level of the SCSI-like block device interface seen by the host, such that even when the host OS thinks the device is safe to remove it might not yet be. Hopefully that is not the case.

| improve this answer | |

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