USB Flash Drive Mounting Is Unreliable

Asked by Bruce Bigby

I just purchased the Pangolin laptop a couple of months ago, but I've been having these intermittent problems with mounting USB flash drives. Most of the time, when I plug a USB stick in, nothing happens. The drive appears in the "Computer" folder, but when I click on it, Ubuntu says that it can't mount the disk.

However, when the drive does appears with a capacity label, it doesn't automatically mount to the desktop. I have to click on the USB drive icon in the Computer folder before Ubuntu mounts the drive.

When the drive appears, but is not mountable, I have to login as root (I gave root a password), and mount the drive manually via command line, which works, but when I unmount the USB disk manually as root, Ubuntu suddenly recognizes the drive and automatically mounts it under my normal user account, which causes it to appear on the desktop.

Is there a fix for this problem?

Question information

English Edit question
System76 Edit question
No assignee Edit question
Solved by:
Thomas Aaron
Last query:
Last reply:
Revision history for this message
Bruce Bigby (bbigby) said :

I forgot to mention the version of Ubuntu: 8.0.4.

Revision history for this message
Thomas Aaron (tom-system76) said :

Thanks Bruce.

First, please try using a different USB drive and see if you get the same results.
Second, if you are not un-mounting the drive before you pull it out of the computer, that could be causing problems.
Third, do you get this behavior after a fresh boot-up? Or is it happening after suspend or hibernate?

Revision history for this message
Bruce Bigby (bbigby) said :

I noticed that after a fresh reboot, USB mounting worked the first time, regardless of whether I inserted my Nokia 800, which has 2 internal disks, or inserted a single USB Flash Disk. The disks even appeared on the desktop, which means Ubuntu mounted the disks

However, when I removed my USB Flash Disk, and reinserted it again, nothing appeared on a desktop. A disk icon appeared only in the Computer folder. It showed the capacity of the disk, too. I had to click on the disk icon to get Ubuntu to mount the it. Then, it appeared on the desktop.

However, when I removed my USB Flash Disk, and reinserted it for the second time, nothing appeared on the desktop again, and although a USB disk icon appeared in the Computer folder, the icon did not show the capacity. The disk was also not mountable. Clicking on the icon produced a "Cannot mount" error.

As I stated in my previous post, I was able to get Ubuntu to mount the disk -- for example, logging in as root, mounting the disk under /dev/sdb1, unmounting the drive, and allow Ubuntu to recognize the disk. However, Ubuntu does not automatically mount the disk. I have to click on the disk in the Computer folder to get Ubuntu to mount it. I have to repeat this last sequence whenever I remove the Flash Disk, and reinsert it. Only a reboot will clear this problem.

It seems that there is some kind of state machine that governs the USB mounting process that is not working correctly. Also, I appear not to be the only one who is encountering this problem.

Revision history for this message
Bruce Bigby (bbigby) said :

Oh, I forgot to mention that I was able to repeatedly, and successfully, mount and unmount my USB Flash Disk on Fedora 8, albeit a different computer. Also note that you shouldn't have to manually unmount a drive, unless you have written data to it. I did not do anything to write to the disks.

Revision history for this message
Best Thomas Aaron (tom-system76) said :

Thank you for the clarification.

I too have inserted and removed drives in Fedora without causing a problem. However, Fedora seems to have different auto-unmounting functionality that Ubuntu.

In Ubuntu, if you do not unmount the disk (regardless of whether or not you wrote data to it), it can confuse HAL. I'm not sure if the Ubuntu devs know about this, or if it is by design that they require manual unmounting. But I've seen it confuse HAL before, so I can confirm it happens.

However, fixing HAL's hotswap protocol is beyond the scope of what we do at System76. I'd recommend always unmounting the drive before removing it. You also might want to file a bug against Ubuntu on this issue.

Revision history for this message
Thomas Aaron (tom-system76) said :

Marking this thread answered.

Revision history for this message
Bruce Bigby (bbigby) said :

Thanks for the thorough answer. I'll check the Ubuntu site for a bug report.

Revision history for this message
Bruce Bigby (bbigby) said :

Update. I reloaded my Pangolin with Fedora 9, and I have no problems with my USB. I don't need to unmount my flash drive before I remove it. Of course, if I write to it, I should always unmount it first so that I don't lose data. However, for other read-only case, I should NOT have to unmount it before removing it. This should not confuse the removable media mounting system.