How can I mount an ejected USB drive without unplugging it?

I am on an Ubuntu 16.04.1 LTS system. I use udisksctl command to mount and unmount my USB flash drive, but I sometimes eject it in nautilus. I can see the device in Disks utility even after ejecting.

I searched the site and found the question How do I mount ejected external USB flash Via terminal, but I could not find an answer to mount an ejected USB drive in the answers of that question.

Can you please explain to me how to mount an ejected USB drive without unplugging it?


Solution 1:

The following will eject the USB device.

sudo eject /dev/sde

The following will mount the USB device without unplugging it.

sudo eject -t /dev/sde

Reference: http://www.upubuntu.com/2011/09/how-to-remount-usb-stick-without.html

Solution 2:

Check your usb flash name with:

lsusb

my sandisk example:

Bus 003 Device 005: ID 0781:540e SanDisk Corp. Cruzer Contour Flash Drive

Now i know my sandisk is on bus 003 and device 005
Then you have to check your usb bus and port number with:

lsusb -t
Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
|__ Port 5: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M

Now i know that bus 3 device 5 is on port 5 so we can go to :

/sys/bus/usb/drivers/usb

and disable port:

sudo tee unbind <<< "3-5" 

or enable port:

sudo tee bind <<< "3-5"