After I have asked the OS to safely remove device (USB) and can no longer access it. Without plugging out and in the USB how can I make the OS gain access to the USB device again?

Basically triggering the same event which is fired when the OS detects a device was plugged in, or something else.


You can do so by following below steps:

a. cd /sys/bus/usb/drivers/usb-storage

b. Find out to which usb bus, your storage device is connected. e.g. If it is connected to bus "2-1.2:1.0"

c. Execute the command echo -n "2-1.2:1.0" > bind It will do the same thing as plug-out and plug-in do

d. You can also umount the storage device by executing: echo -n "2-1.2:1.0" > unbind

Replace the bus ID by appropriate bus id


There may be easier ways depending on your DE, etc, but here's a basic strategy that will work everywhere:

I. Figure out the device node.

These are in the /dev/ directory, and pretty easy to find once you get the idea. A big clue is that USB storage devices usually have at least one partition. This means there will be at least two nodes, one for the device as a whole and one for each partition. The naming scheme gives this away, because if the device is sda, the first partition will be sda1. If you look at ls /dev, you'll notice there aren't that many things following that pattern. Ignore all the tty and vcs things.

Also, the name may follow the same pattern as your hard drive(s), using a, b, c etc. in order. For example, if you have two hard drives and one is sda and the other is sdb, a USB device added subsequently might be sdc. These then each have partitions (sda1, sda2, sdb1, sdc1, etc).

Note that it is possible to format a device such that it doesn't have any partitions, in which case the device and the filesystem on it are accessed by the same node with no number (e.g. sdc). You probably haven't done that, but just in case, keep in mind it is possible.

The most sure fire way to figure this out the first time is to go ls /dev > one.txt while the device is still plugged in but unmounted. Now pull it out, wait a few seconds, and ls /dev > two.txt. Then: diff one.txt two.txt. Whatever comes out is the name of your device node. It will probably be the same next time, unless you have a lot of devices you are often adding and removing, in which case the a, b, c suffix may be different.

You can enforce specific device node names for specific devices using udev, but if it's just for this, it isn't really worth bothering with. It is handy if you want things mounted specific ways at boot.

II. Mount the device/partition.

You need superuser privileges:

sudo mount /dev/sdc1 /mnt/usb

That's the partition node first, then the mount point. See man mount.

  • 1
    Remounting is only half the battle. First, you need to reconnect the USB device. – Gilles 'SO- stop being evil' Nov 17 '13 at 20:53
  • @Gilles : I haven't seen one become disconnected as per the dupe you linked, too bad there was no real explanation for that. I guess it's up to the OP to clarify what was meant here. – goldilocks Nov 17 '13 at 21:19

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