0

I work with a lot of low quality USB flash memory modules - some of them can even hang the USB controller and block all traffic until I remove them.

I'm testing these drives using f3 and a custom Bash script to make it suitable for mass production.

My script uses /dev/disk/by/path links to make it possible to link physical location in a USB hub to an entry on the screen.

Sometimes I have broken links in /dev/disk/by-path - I also noticed that lsblk might list drives that have already been removed,and Dolphin file manager lists removable drives that are long gone (physically disconnected).

Is there anything I can do something to clean up these broken symlinks without rebooting the system?

I've also asked a possibly related question: Multiple links in /dev/disk/by-path pointing to the same /dev/sd* device files

  • You can reset the USB root controller (google), that should re-enumerate all USB devices. If during this process the broken symlinks don't get removed (only you can test that), write a script that removes them before resetting the controller. – dirkt Oct 11 '18 at 9:23
  • Could you please link a specific solution to resetting the USB root controller? I've tried resetting the individual ports by issuing unbind/bind commands, but it didn't work. Also: should I manually rm broken links in /dev/disk/by-path? Is that safe? – unfa Oct 11 '18 at 10:13
  • Quick googling finds e.g. this, around Figure 7 (use the correct controller instead of ohci). Yes, it's safe to remove symlinks in /dev/disk, and yes, you must manually remove them if your udev rules don't remove them automatically. – dirkt Oct 11 '18 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.