70

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).

9 Answers9

21

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.

jon_d
  • 1,043
  • 7
    "suspend" doesn't work on kernels after 2.6.36. – alexisdm Jan 31 '14 at 13:14
  • 1
    Assuming dmesg reports the correct device ID ("usb 9-4: USB disconnect [...]"), this does not work on latest Arch Linux. There is no path /sys/bus/usb/devices/9-4 afterwards. – l0b0 Mar 21 '14 at 07:07
  • 1
  • dmesg:
  • WARNING! power/level is deprecated; use power/control instead

    1. http://superuser.com/questions/371068/is-there-a-way-to-power-down-a-usb-device-using-software
    – socketpair Dec 21 '15 at 18:06
  • Also suspend is no longer supported on recent kernel versions.... – Gert van den Berg Jun 22 '18 at 14:39
  • permission denied even with sudo – endolith Feb 01 '22 at 17:23