# [USB] USB-stick at low speed

## MadEgg

I've got an USB-stick/MP3 player(X-Micro Easy MP3 Player, which, according to the specs should support high-speed transfers at 480 MBit, but when I copy files to it the speed is only about 240 KiB/s according to KDE's file transfer dialog, while USB2 should be able to transfer about 50 MiB/s, and the USB stick according to the website should be able to write at 6 MiB/s, so I'm not getting anywhere near the performance I would expect.

This is what appears in 'dmesg' when I plug my USB-stick in:

```

usb 5-6: new high speed USB device using ehci_hcd and address 6

scsi1 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 6

usb-storage: waiting for device to settle before scanning

  Vendor: X-Micro   Model: Easy MP3 Player   Rev: 1.06

  Type:   Direct-Access                      ANSI SCSI revision: 00

SCSI device sde: 507904 512-byte hdwr sectors (260 MB)

sde: Write Protect is off

sde: Mode Sense: 23 00 00 00

sde: assuming drive cache: write through

SCSI device sde: 507904 512-byte hdwr sectors (260 MB)

sde: Write Protect is off

sde: Mode Sense: 23 00 00 00

sde: assuming drive cache: write through

 sde: sde1

Attached scsi removable disk sde at scsi1, channel 0, id 0, lun 0

usb-storage: device scan complete

```

So it actually recognizes it as a high-speed device... 

The only thing I can think of is related to another post of mine on this forum; the following appears in my dmesg about EHCI:

```

ehci_hcd 0000:00:1d.7: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller

ehci_hcd 0000:00:1d.7: debug port 1

ehci_hcd 0000:00:1d.7: BIOS handoff failed (104, 01010001)

ehci_hcd 0000:00:1d.7: continuing after BIOS bug...

ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 5

ehci_hcd 0000:00:1d.7: irq 20, io mem 0xf7fffc00

PCI: cache line size of 128 is not supported by device 0000:00:1d.7

ehci_hcd 0000:00:1d.7: USB 2.0 initialized, EHCI 1.00, driver 10 Dec 2004

```

But it does say that USB 2.0 is initialized, so why doesn't it work?

----------

## rukh

Hi, did you enable USB 2.0 in your bios? That did it for me.

----------

## MadEgg

Well.... enable? In the BIOS I can choose between FullSpeed and HiSpeed, and I've got it set to HiSpeed, that should be right, right?

----------

## dsd

are you mounted with "-o sync" ?

----------

## MadEgg

Everything is handled automatically by media:/ KDE IO-slave, udev and the like, but when the stick is mounted, the following line appears in my /etc/mtab file:

```

/dev/sda1 /media/X-MICRO_MP3 vfat rw,nosuid,nodev,sync,noatime,utf8,user=eggie 0 0

```

So, yes it's mounted sync. I know that the copying will appear to go faster when it's mounted async but that will not mean I will be able to unplug my USB stick sooner, will it?

----------

## widan

 *MadEgg wrote:*   

> So, yes it's mounted sync. I know that the copying will appear to go faster when it's mounted async

 

Not only appear. It will be faster, even including the time to sync the disk (when running async, the kernel is able to buffer things, so I/O is more efficient: if a block is modified ten times, then it will be written only once at the end, and not the other 9 times - and the FAT and the free block maps are modified a lot when writing).

 *MadEgg wrote:*   

> but that will not mean I will be able to unplug my USB stick sooner, will it?

 

Run "sync" before unplugging (or unmount it, or ask KDE to unmount it). Don't unplug it without warning when mounted async, especially if you've just written to it. It's the best way to corrupt the filesystem.

----------

## MadEgg

 *widan wrote:*   

>  *MadEgg wrote:*   So, yes it's mounted sync. I know that the copying will appear to go faster when it's mounted async 
> 
> Not only appear. It will be faster, even including the time to sync the disk (when running async, the kernel is able to buffer things, so I/O is more efficient: if a block is modified ten times, then it will be written only once at the end, and not the other 9 times - and the FAT and the free block maps are modified a lot when writing).

 

Yes, but what I'm actually trying to do is copy new songs over to my USB Stick. So it's like 12 files of about 3 MiB each. I thought async only mattered much when you're doing a lot of editing or are copying lots of small files over. Anyway, I'd be willing to try(although I doubt that would make the difference between 250 KiB/s and 6 MiB/s, that's like 36 times as slow as I would expect), but I don't have an entry in fstab for it; the stick is mounted in /media automatically. I don't know what is doing that, is it the KDE Media IOSlave, or is it ivman? And where can I configure that to mount it async instead of sync?

----------

## widan

 *MadEgg wrote:*   

> And where can I configure that to mount it async instead of sync?

 

Maybe this ? Or just remount it async after it's mounted ("mount /media/X-MICRO_MP3 -o async,remount").

----------

## MadEgg

Right, I just tried it, and in fact it does help. 

What I tested is this: first I emptied my USB stick and copied 171 MiB over while it was mounted sync. That took 11 minutes, so about 260 KiB/s. 

After that I emptied my USB stick, remounted it async and copied it all over again, both using Konqueror. The second time it took 25 seconds, so that's about 6.8 MiB/s, the speed I was expecting.

But I do not believe that this is simply caused by the difference in mounting sync and async, and in fact I like having removable devices mounted sync better, so what is the reason for this enormous difference in speed? Is there any way I can improve my speed while it's mounted sync?

----------

## dsd

there is a detailed explanation here:

http://bugzilla.kernel.org/show_bug.cgi?id=4882 comment 14

----------

## MadEgg

Right, that explains why it's happening. Now just to wait for a fix  :Wink:  Until then I'll have to settle for mounting async...

----------

## knirscher

Hopefully somebody is still reading this:

I have an external Seagate HDD which is capable of FireWire, USB 2 and USB 1.2. 

I experience the same very slow write speeds to the HDD as MadEgg with a USB 2 connection _and_ with a FireWire connection. Ok, this is not surprising, but what surprises me is that I have these slow write speeds even though my HDD is actually formatted ext3. Of course, if I mount it async, i get the full speeds.

Transferring 1.4 GB with async takes about 90 seconds. => 15.000 KB/s

Transferring 67 MB with sync takes about 238 seconds. => 280 KB/s

In the bug report (http://bugzilla.kernel.org/show_bug.cgi?id=4882) they blame the vfat developers. So either I am seeing a different problem here or they are wrong. 

Any ideas?

----------

## dsd

looks like ext3's sync implementation has the same semantics as the new vfat one.

remember that sync is *supposed* to synchronise as much as it can.

the fact that it synchronises way too much for "sync" to be a sensible option to allow for unplug-without-unmount for flash devices is an entirely separate problem, which hasnt been solved yet.

----------

