# USB FAT32 drives operate ridiculously slow

## Gabriel_Blake

A few kernel updates ago every thing was fine. Now ALL my flash drives and memory cards accessed via USB work slow and act strange. Example: when writing 300MB to a pendrive, the progress shows that the first 60MB are copied  in an instant, but the following take ages. The data is written correctly. The pendrive has a rated min 9MB/s write and that is true on other computers. 

What's wrong ??

Example with 2GB flash card inside a mobile phone:

dmesg output(with mount-unmount-mount):

```
usb 5-2: new full speed USB device using uhci_hcd and address 2

usb 5-2: configuration #1 chosen from 1 choice

scsi5 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 2

usb-storage: waiting for device to settle before scanning

scsi 5:0:0:0: Direct-Access     Nokia    Nokia 5310 Xpres 0000 PQ: 0 ANSI: 4

sd 5:0:0:0: Attached scsi generic sg2 type 0

usb-storage: device scan complete

sd 5:0:0:0: [sdb] Adjusting the sector count from its reported value: 3842049

sd 5:0:0:0: [sdb] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)

sd 5:0:0:0: [sdb] Write Protect is off

sd 5:0:0:0: [sdb] Mode Sense: 04 00 00 00

sd 5:0:0:0: [sdb] Assuming drive cache: write through

sd 5:0:0:0: [sdb] Adjusting the sector count from its reported value: 3842049

sd 5:0:0:0: [sdb] Assuming drive cache: write through

 sdb:

sd 5:0:0:0: [sdb] Adjusting the sector count from its reported value: 3842049

sd 5:0:0:0: [sdb] Assuming drive cache: write through

sd 5:0:0:0: [sdb] Attached SCSI removable disk

sky2 eth0: enabling interface

ADDRCONF(NETDEV_UP): eth0: link is not ready

sky2 eth0: Link is up at 100 Mbps, full duplex, flow control both

ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

usb 5-2: USB disconnect, address 2

VFS: busy inodes on changed media or resized disk sdb

usb 5-2: new full speed USB device using uhci_hcd and address 3

usb 5-2: configuration #1 chosen from 1 choice

usb 5-2: USB disconnect, address 3

FAT: Directory bread(block 471) failed

FAT: Directory bread(block 472) failed

FAT: Directory bread(block 473) failed

FAT: Directory bread(block 474) failed

FAT: Directory bread(block 475) failed

FAT: Directory bread(block 476) failed

FAT: Directory bread(block 477) failed

FAT: Directory bread(block 478) failed

FAT: Directory bread(block 479) failed

FAT: Directory bread(block 480) failed

FAT: Directory bread(block 481) failed

FAT: Directory bread(block 482) failed

FAT: Directory bread(block 483) failed

FAT: Directory bread(block 484) failed

FAT: Directory bread(block 485) failed

FAT: Directory bread(block 486) failed

FAT: Directory bread(block 487) failed

FAT: Directory bread(block 488) failed

FAT: Directory bread(block 489) failed

FAT: Directory bread(block 490) failed

FAT: Directory bread(block 491) failed

FAT: Directory bread(block 492) failed

FAT: Directory bread(block 493) failed

FAT: Directory bread(block 494) failed

FAT: Directory bread(block 495) failed

FAT: Directory bread(block 496) failed

FAT: Directory bread(block 497) failed

FAT: Directory bread(block 498) failed

FAT: Directory bread(block 499) failed

FAT: Directory bread(block 500) failed

FAT: Directory bread(block 501) failed

FAT: Directory bread(block 502) failed

FAT: Directory bread(block 471) failed

FAT: Directory bread(block 472) failed

FAT: Directory bread(block 473) failed

FAT: Directory bread(block 474) failed

FAT: Directory bread(block 475) failed

FAT: Directory bread(block 476) failed

FAT: Directory bread(block 477) failed

FAT: Directory bread(block 478) failed

FAT: Directory bread(block 479) failed

FAT: Directory bread(block 480) failed

FAT: Directory bread(block 481) failed

FAT: Directory bread(block 482) failed

FAT: Directory bread(block 483) failed

FAT: Directory bread(block 484) failed

FAT: Directory bread(block 485) failed

FAT: Directory bread(block 486) failed

FAT: Directory bread(block 487) failed

FAT: Directory bread(block 488) failed

FAT: Directory bread(block 489) failed

FAT: Directory bread(block 490) failed

FAT: Directory bread(block 491) failed

FAT: Directory bread(block 492) failed

FAT: Directory bread(block 493) failed

FAT: Directory bread(block 494) failed

FAT: Directory bread(block 495) failed

FAT: Directory bread(block 496) failed

FAT: Directory bread(block 497) failed

FAT: Directory bread(block 498) failed

FAT: Directory bread(block 499) failed

FAT: Directory bread(block 500) failed

FAT: Directory bread(block 501) failed

FAT: Directory bread(block 502) failed

FAT: Directory bread(block 471) failed

FAT: Directory bread(block 472) failed

FAT: Directory bread(block 473) failed

FAT: Directory bread(block 474) failed

FAT: Directory bread(block 475) failed

FAT: Directory bread(block 476) failed

FAT: Directory bread(block 477) failed

FAT: Directory bread(block 478) failed

FAT: Directory bread(block 479) failed

FAT: Directory bread(block 480) failed

FAT: Directory bread(block 481) failed

FAT: Directory bread(block 482) failed

FAT: Directory bread(block 483) failed

FAT: Directory bread(block 484) failed

FAT: Directory bread(block 485) failed

FAT: Directory bread(block 486) failed

FAT: Directory bread(block 487) failed

FAT: Directory bread(block 488) failed

FAT: Directory bread(block 489) failed

FAT: Directory bread(block 490) failed

FAT: Directory bread(block 491) failed

FAT: Directory bread(block 492) failed

FAT: Directory bread(block 493) failed

FAT: Directory bread(block 494) failed

FAT: Directory bread(block 495) failed

FAT: Directory bread(block 496) failed

FAT: Directory bread(block 497) failed

FAT: Directory bread(block 498) failed

FAT: Directory bread(block 499) failed

FAT: Directory bread(block 500) failed

FAT: Directory bread(block 501) failed

FAT: Directory bread(block 502) failed

usb 5-2: new full speed USB device using uhci_hcd and address 4

usb 5-2: configuration #1 chosen from 1 choice

scsi6 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 4

usb-storage: waiting for device to settle before scanning

usb 5-2: USB disconnect, address 4

usb 5-2: new full speed USB device using uhci_hcd and address 5

usb 5-2: configuration #1 chosen from 1 choice

scsi7 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 5

usb-storage: waiting for device to settle before scanning

scsi 7:0:0:0: Direct-Access     Nokia    Nokia 5310 Xpres 0000 PQ: 0 ANSI: 4

sd 7:0:0:0: Attached scsi generic sg2 type 0

sd 7:0:0:0: [sdc] Adjusting the sector count from its reported value: 3842049

sd 7:0:0:0: [sdc] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)

sd 7:0:0:0: [sdc] Write Protect is off

sd 7:0:0:0: [sdc] Mode Sense: 04 00 00 00

sd 7:0:0:0: [sdc] Assuming drive cache: write through

usb-storage: device scan complete

sd 7:0:0:0: [sdc] Adjusting the sector count from its reported value: 3842049

sd 7:0:0:0: [sdc] Assuming drive cache: write through

 sdc:

sd 7:0:0:0: [sdc] Adjusting the sector count from its reported value: 3842049

sd 7:0:0:0: [sdc] Assuming drive cache: write through

sd 7:0:0:0: [sdc] Attached SCSI removable disk

```

----------

## Mad Merlin

The initial 60M going fast is because the kernel will buffer that much data and return (fast) before actually syncing it to the media (slow). However, the errors in your log there look like that particular flash drive is dying on you, have you tried a different one?

----------

## Gabriel_Blake

It's the same on all flash devices. Even really new ones. I have 2 pendrives, 2 micro-SD cards (accessed via reader), 1 SD card (accessed via reader) and 1 MP3 player with build in memory (accessed via USB). 

ALL WORK BADLY !

What's more, they work flawlessly on other computers and systems :/

Any ideas ??

----------

## depontius

I seem to remember there being something in the kernel config about 2 different ways to access USB memory.  There was some sort of old, slow way that, if enabled, would be used by default.  Then there are the newer ways, which are faster.  I don't remember much more than this, but you might want to review your kernel config, and be sure to read the help text.  I don't have a flash stick handy at the moment, or I'd try to get some more information for you.

----------

## Link31

It looks like your kernel is using UHCI, which is actually USB 1.0/1.1.

On my system, USB keys use the EHCI driver (USB 2). So there is something wrong with your kernel configuration. Either you forgot to enable EHCI, or both drivers are enabled but UHCI takes priority (the issue depontius is talking about). Or your USB controller is USB1 only...

----------

## Gabriel_Blake

lsusb

 *Quote:*   

> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> ...

 

lsusb -v -d 1d6b:0001

 *Quote:*   

> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> Device Descriptor:
> 
>   bLength                18
> ...

 

lsusb -v -d 1d6b:0002 *Quote:*   

> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> 
> Device Descriptor:
> 
>   bLength                18
> ...

 

So I guess you're write right about  UHCI. However this is a fairly new machine and it MUST have USB 2.0, especially that it worked fine in the past. My kernel has UHCI, OHCI and EHCI. So it's probably a priority error. I'll try to throw out the UHCI driver.

----------

## Erlend

 *Gabriel_Blake wrote:*   

> 
> 
> So without the driver, the USB ports aren't working at all. I'm SURE that they are 2.0 and have been working as 2.0. However now something went wrong.... Any ideas what it could be ??

 

I get the same problem.  It's very strange, I've seen it in a few different machines (all running gentoo).  It tends to be the front USB ports which have the issue.

----------

