Linux – How to reconnect a logically disconnected USB device

linuxusbusb-drive

It is possible for a USB storage device to become logically disconnected: the device is still plugged in, but is invisible from the operating system (e.g. it's not listed under /proc/bus/usb). Maybe this can happen to other kinds of USB or other removable devices as well. This can happen for example:

  • after Nautilus has unmounted a USB storage device;
  • after VirtualBox has claimed a USB storage device (the device disappears from the Linux host when it is attached in the guest, and does not automatically reappear if it is detached from the guest).

What is going on in the driver or in the hardware, and most importantly, (how) can the device be logically reconnected (without physically plugging it out and back in)?

Note that this question is not about mounting. In the “logically disconnected” state, the kernel believes there is nothing on the USB bus (and so of course there is no entry under /dev).

Best Answer

It is sometimes possible to do a power cycle on branch of the USB bus where the device is plugged :

# echo suspend > /sys/bus/usb/devices/1-1/power/level
# echo auto > /sys/bus/usb/devices/1-1/power/level

The 1-1 should be adjusted to your configuration. You can see to which part of the USB tree your device is plugged by running lsusb -t before ejecting it.

You can find detailed information on the linux-usb mailing-list, this thread for example.

Related Question