USB flash unplugged suddenly.

New to Debian (Or Linux in general)? Ask your questions here!

USB flash unplugged suddenly.

Postby hack3rcon » 2020-07-29 17:03

Hello,
I have a USB flash that it has a problem and umounted suddenly and I should unplug and plug it from USB port for mount.
Can I do this plug and unplug by Linux and not physically?

Thank you.
hack3rcon
 
Posts: 396
Joined: 2015-02-16 09:54

Re: USB flash unplugged suddenly.

Postby CwF » 2020-07-30 16:57

If I remember right you have some vm capability? You don't need them exactly, but if you pass the device temporarily to a vm and back it will force a refresh of the device. Or you happen to have it on a powered hub that can cycle the power. Or if you like danger, dig for the sysfs commands.

The sysfs approach works and if you fool around wrong bad things happen.
with your device id and the correct directory, something like, if the id is the argument? Could be wrong..
#echo pcid > /sys/bus/usb/devices/usb4/remove
To add it back in often just modprobe the correct driver module.
Maybe look at /sys/bus/usb/uevent and /sys/bus/usb/drivers_probe instead.

Enjoy!
CwF
 
Posts: 721
Joined: 2018-06-20 15:16

Re: USB flash unplugged suddenly.

Postby hack3rcon » 2020-07-31 05:06

CwF wrote:If I remember right you have some vm capability? You don't need them exactly, but if you pass the device temporarily to a vm and back it will force a refresh of the device. Or you happen to have it on a powered hub that can cycle the power. Or if you like danger, dig for the sysfs commands.

The sysfs approach works and if you fool around wrong bad things happen.
with your device id and the correct directory, something like, if the id is the argument? Could be wrong..
#echo pcid > /sys/bus/usb/devices/usb4/remove
To add it back in often just modprobe the correct driver module.
Maybe look at /sys/bus/usb/uevent and /sys/bus/usb/drivers_probe instead.

Enjoy!

When it unplugged then I can't mount it in VM too.
hack3rcon
 
Posts: 396
Joined: 2015-02-16 09:54


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable