Is it possible to re-mount a USB drive, without actually removing and re-inserting the physical USB itself?

I was wondering this one after I accidentally unmounted a USB Flash drive from Thunar. I thought why bother taking it out and putting in again, there has got to be a way. Googling for a few minutes gave me nothing.

NOTES:

  • This is not a simple case of mount /dev/sdb /mnt/usb
  • The drive was auto-mounted with gvfs and after unmounting, it has completely disappeared from /dev/sdb/
  • dmesg -w gives me usb 1-1.2: USB disconnect, device number 7
  • The device folder is gone from /sys/bus/usb/devices/ and /sys/bus/usb/drivers/ (1-1.2 folder does not exist)
  • Tried doing echo "1-1.2" > /sys/bus/usb/drivers/usb/bind ==> write error: No such device
  • In some forum, someone said that udevadm trigger would do the trick, but it does not work.

It seems that gvfs has completely vanished the device. And I wish there was a way to trigger the system into recognizing the USB again, it would be a very helpful functionality to have.

p.s. ( Resetting the computer does not count )

Posted Aug 21, 2019, 5:33 PM UTC

5311
dropdatabaseOP•

OK found it, I had to reset the PCI USB controller with this: (After discovering the PCI address and USB type of the hub)

echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci_hcd/bind

I followed this guide: https://www.linux.org/threads/resetting-the-usb-subsystem.10404/

I knew this could be done! Perhaps this post will help someone in the future.

46
parkerlreed•

This issue isn't inherently gvfs. Dolphin/Plasma does this too.

What happens is when you eject, it doesn't just unmount (which I wish it did) but completely removes the device (as you saw). It's probably something in udisks2 handling that.

3
Morganamiloflair text here•

To be specific. The drive was not just unmounted, but ejected. No idea how to get it to appear again though.

18
dropdatabaseOP•

Yes, 'eject' seems more appropriate. All I did was click the eject button by the drive name. I'm still researching, trying to figure out how to reset the entire usb hub the drive was on

7
Sir_Kubis•

btw, does anyone know how to eject an usb like that using standard tools like mount/umount or udevil?

7
iggy_koopa•
9
Sir_Kubis•

thanks dude

1
shdriesner•

I first of all don't install any automounting packages on Arch. My main flow for managing USB devices is to do the following:

Before inserting the USB drive, I run 'lsblk' in the terminal to see what disks already exist, then I insert the USB drive and run 'lsblk' again to see which new drive showed up. I then just 'sudo mount [partition] [path]' to mount the drive and 'sudo umount [path]' to unmount. Note that this will only mount the drive as read only by default. If you want the drive to be read/writeable by the user, you will need to pass additional mount options (e.g. sudo mount -o user,rw ...). Also, if you did write anything to the drive, run 'sync' before 'umount'.

In case its not clear from the above, [partition] refers to disk partition, e.g. /dev/sdb1, and [path] refers to an empty directory path like /mnt.

4
_mitchejj_•

Question, how would you handle mounting removable devices on a multi-user system? Everything you said makes since for a personal system... but I think this advice falls down if the computer is shared so I’m wondering what you do for multiple users.

1
shdriesner•
1
Citizen_Crom•

Saved for later. I'm testing a bad/cheap USB storage device for fun and it keeps dying and needing a remount

3