LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Problem disconnecting USB flash drive (https://www.linuxquestions.org/questions/linux-hardware-18/problem-disconnecting-usb-flash-drive-360399/)

Mordechai 09-05-2005 09:34 AM

Problem disconnecting USB flash drive
 
I have an MP3 player which SuSE 9.3 sees as removable media (which I assume is normal). Sometimes when I disconnect it, my system doesn't seem to notice. This causes a problem when I try to reconnect it; the system doesn't see the "new" drive. As I'm new to linux, my troubleshooting arsenal is still quite limited. I've tried
Code:

umount /dev/sda1/
but it didn't help.

I'd also appreciate an general troubleshooting tips and links.

Thanks.

oneandoneis2 09-05-2005 10:12 AM

You should never disconnect without unmounting it first

Mordechai 09-05-2005 01:15 PM

Quote:

Originally posted by oneandoneis2
You should never disconnect without unmounting it first
Doesn't that violate the whole idea behind something being hot-swapable?

Also, what about floppies and CDs? they're also "removible media"?

oneandoneis2 09-06-2005 03:39 AM

Nope. You can plug & unplug USB devices to your hearts content.

But when you mount something, regardless of what, you should always unmount it before removing it.

CDs are a good parallel: A music CD can be ejected with impunity, but a mounted CD will not eject until it's unmounted. Because you should never remove mounted media.

Especially when it comes to USB flash, because they have limited write cycles: To prolong their life, they should be set to be written to as little as possible. Once this is set up, writes will be done 'virtually', and the physical writes will only be done when needed.

Your flash drive will last a lot longer like this, but if you don't unmount it before removing it, the data might not have been physically written.

Mordechai 09-06-2005 04:44 AM

Fair enough, however, as I don't mount it why should I need to umount it? And if it is automatically mounted when I attach it, then it is reasonable to expect it to also automatically umount when I detach it. If it's like a CD, when I remove/eject it the system should recognize this. Normally, that's exactly what happens; I plug it in and a few seconds later I have /media/usbdisk/ and /dev/sda1/ available and when I detach it, a few seconds later they're gone. But sometimes there are glitches and the system doesn't realize the device isn't still attached.

So the question is: "When the system doesn't recognize that the device has been detached, how do I force it to do so short of rebooting?"

Regarding data not being written, that's not an issue as a window opens with a progress bar to provide status.

As far a limited life cycle, as I generally only listen to a podcast once, I'll just have to live with it.

oneandoneis2 09-06-2005 04:54 AM

It DOES get mounted - it's just done automatically. But it can't be auto-unmounted (properly) as the event that would trigger an unmount is the removal of the hardware that should be unmounted, so it's no longer present to be unmounted.

My advice is to set up an "unmount" shortcut & make sure you always use it. That would solve the whole problem.

If you really don't want to do that, next time the problem occurs, post:

- The output (if any) from the failed "unmount" command

- The output of "mount" alone, which should list all mounted drives

- The output of the last few lines of "dmesg"

- The last few lines of your syslog file

and we might be able to track down the problem & suggest a fix!

abisko00 09-06-2005 05:04 AM

I am not sure if this applies to 9.3 as well, since a lot has changed with the hotplug scripts, but in 9.1 it seems to be required to run the 'eject' command on some USB devices in order to stop SUSE from accessing it (e.g. iPOD-mini).

It could cause problems if you remove the drive anyway: if you remove the drive while you are still accessing it (e.g. a konqueror window is open), it may not be unmounted properly.

I never got happy with the submount way of mounting. I prefer to have better control on what is mounted and what is not.

Mordechai 09-06-2005 10:27 AM

I figured anything Windows could do linux could do better.

The eject command work (I know, no surprise for you, but is't a new command for me) when things are normal. I'm guessing that it might work for the problem as well. We'll see.

As far as the umount failing, it does so silently.

BTW, do you have any good links regarding dmesg or syslog? If not, I'm sure I could find something at TLDP.

Thank for the help.

oneandoneis2 09-06-2005 11:09 AM

"man dmesg" should tell you a bit about dmesg.

The syslog depends on your logger - there are several, such as syslog, syslog-ng, and metalogger. You'll have to find out which one you use before you can find out more about it :) They usually write to /var/log/messages tho


All times are GMT -5. The time now is 12:32 PM.