USB flash unplugged suddenly.

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
hack3rcon
Posts: 530
Joined: 2015-02-16 09:54

USB flash unplugged suddenly.

#1 Post by hack3rcon »

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.

CwF
Posts: 1189
Joined: 2018-06-20 15:16
Has thanked: 2 times
Been thanked: 6 times

Re: USB flash unplugged suddenly.

#2 Post by CwF »

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!

hack3rcon
Posts: 530
Joined: 2015-02-16 09:54

Re: USB flash unplugged suddenly.

#3 Post by hack3rcon »

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.

Post Reply