# Very slow write to USB drive on kernel 2.6.19-r4 [Opened]

## trumee

Guys,

I have a horribly slow write to my USB pen drive.  I have mounted the drive using 'sync' option, since i want to know when the writing is finished. The write is very slow about 30kb/s, however the read on the drive is very fast.

My system is ASUS P5B deluxe. When I insert the drive I get:

```

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

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

scsi7 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 6

usb-storage: waiting for device to settle before scanning

scsi 7:0:0:0: Direct-Access     JetFlash TS2GJFV10        0.00 PQ: 0 ANSI: 2

SCSI device sdb: 4030463 512-byte hdwr sectors (2064 MB)

sdb: Write Protect is off

sdb: Mode Sense: 00 00 00 00

sdb: assuming drive cache: write through

SCSI device sdb: 4030463 512-byte hdwr sectors (2064 MB)

sdb: Write Protect is off

sdb: Mode Sense: 00 00 00 00

sdb: assuming drive cache: write through

 sdb: sdb1

sd 7:0:0:0: Attached scsi removable disk sdb

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

usb-storage: device scan complete

```

Does anybody know what is going on? Here is my USB section in kernel configuration:

```

# USB support

#

CONFIG_USB_ARCH_HAS_HCD=y

CONFIG_USB_ARCH_HAS_OHCI=y

CONFIG_USB_ARCH_HAS_EHCI=y

CONFIG_USB=y

# CONFIG_USB_DEBUG is not set

#

# Miscellaneous USB options

#

CONFIG_USB_DEVICEFS=y

# CONFIG_USB_BANDWIDTH is not set

# CONFIG_USB_DYNAMIC_MINORS is not set

# CONFIG_USB_SUSPEND is not set

# CONFIG_USB_OTG is not set

#

# USB Host Controller Drivers

#

CONFIG_USB_EHCI_HCD=m

# CONFIG_USB_EHCI_SPLIT_ISO is not set

# CONFIG_USB_EHCI_ROOT_HUB_TT is not set

# CONFIG_USB_EHCI_TT_NEWSCHED is not set

# CONFIG_USB_ISP116X_HCD is not set

CONFIG_USB_OHCI_HCD=m

# CONFIG_USB_OHCI_BIG_ENDIAN is not set

CONFIG_USB_OHCI_LITTLE_ENDIAN=y

CONFIG_USB_UHCI_HCD=m

# CONFIG_USB_SL811_HCD is not set

#

# USB Device Class drivers

#

CONFIG_USB_ACM=m

CONFIG_USB_PRINTER=y

#

# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'

#

#

# may also be needed; see USB_STORAGE Help for more information

#

CONFIG_USB_STORAGE=m

# USB Input Devices

#

CONFIG_USB_HID=y

CONFIG_USB_HIDINPUT=y

```

Last edited by trumee on Sun Jan 28, 2007 9:23 am; edited 2 times in total

----------

## bjlockie

It is not caching write operations so each write is done immediately.

Search for "write caching Linux USB".

----------

## dsd

use flush instead of sync

----------

## trumee

Thanks flush did it. I am getting much better speed now. The next step was to get 'flush' in the mount options while using Kde. The mediamanager in kde 3.5.5/3.5.6 does not recognise the flush keyword so an ugly hack to get this flush keyword is to do this:

Add this to /usr/share/hal/scripts/hal-system-storage-mount , before the hal-set-property at the bottom of the file

```

# special options handling for certain filesystems

 case "$MOUNTTYPE" in

     vfat)

    MOUNTOPTIONS="$MOUNTOPTIONS,flush"

    ;;

 esac
```

In addition add the following line 

```

<append key="volume.mount.valid_options" type="strlist">flush</append>

```

whereever you see vfat or removable device in  /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi

Now the device will be mounted using 'flush'. There is more detail on this problem on bugs.kde.org

----------

## trumee

 *dsd wrote:*   

> use flush instead of sync

 

The flush parameter seems to only work on kernel 2.6.19. On kernel 2.6.18-suspend2-r4 mount gives the following error

```

#mount /dev/sdb1 /mnt/usb/ -o uid=1000 -o flush

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,

       missing codepage or other error

       In some cases useful info is found in syslog - try

       dmesg | tail  or so

#dmesg|tail

FAT: Unrecognized mount option "flush" or missing value
```

Is there some solution for 2.6.18 kernel?

----------

## Vadim

```
Is there some solution for 2.6.18 kernel?
```

Just try to mount without sync... To know when the writing is finished - look at the pen drive led. It works for me.  :Smile: 

----------

