Re: USB disk disconnect problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 21, 2022 at 12:17:30PM +0100, James Dutton wrote:
> Hi,
> 
> Say I have mounted a usb disk.
> I then disconnect the usb device
> Linux complains about failed writes etc.
> I then plug the usb device back in
> Linux still complains about failed writes, and does not recover.
> 
> How do I get Linux to recognise the reinserted usb disk and carry on as normal?

As far as I know, there's only way way to do it: Go into system suspend 
before disconnecting the USB drive, and plug the drive back in before 
waking the system up.

> I know my suggested behaviour might be detrimental for some users, in
> case one modifies the usb disk in another computer and then comes
> back, but I would like an option that assumes it has not been plugged
> into anything else.

The resume procedure makes this assumption, if it finds that something 
has been disconnected and reconnected.

> The reason being, I have a system that boots from a USB disk.
> Due to interference, the USB device disconnects for a second or two
> and then comes back, but Linux does not see it and I have to reboot
> Linux to recover. So, in this situation I wish Linux to be able to
> recover immediately, without needing a reboot.

There is no way to do this.  For example, consider all those failed 
writes that you get error messages about.  Once they have failed, the 
system does not try to remember them in case there's a possibility of 
trying them again later.  They're just lost.

Similarly with failed reads.  When a program tries to read something 
from a disk and the read fails, the program generally does not wait for 
a while and then retry the read, to see if the disk will magically start 
working again.

> The physical USB device removal then reinserting reproduces the
> problem I am seeing, so I thought it would be a good example to get
> working, if we could.
> 
> Can anyone give me any pointers as to where to start with fixing this?

Sorry I can't be of any more help.

Alan Stern



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux