# Kernel USB mass storage driver problem / bug?

## Januszzz

Hi everybody,

I recently bought 2 large USB disk for doing backups. New disks are approx. 400 GB in large, usb 2.0. My backup program (Bacula 1.36.3) sucessfully writes to one of that disks  and everything goes well. I bought usb disks for quick solution for doing backups as my streamer eaten another tape   :Confused:  , and I would be happy to replace it with usb disks for convienience, reliability and - price.

The problem occurrs when I need to copy a bigger file from one disk to another: no matter if it is normal SCSI disk in the computer or second USB drive. While copying bacula archive (a single file, which is 8GB in large now and will grow up to 50GB) afer some time (300-900MB) copying process slows down until it stops, slowly restart and continue copying. Because of that slow average speed of copying to and from usb 2.0 is about 2-3 MB/s only. While this process goes I can see in logs:

[kernel] usb 1-2: reset high speed USB device using ehci_hcd and address 5

This line repeats continously until I finish copying. After starting copying again, I still can see the message, but now since the very beginning. Unregistering the device and restarting the backup machine solves a problem until next copy.

I've checked md5 sums of copies and they are correct (uf!), I can also restore backups. I assume the problem lies somewhere in kernel, because it happens also on another computer. 

I have to say that I really need a solution, because I feel unsafe to perform backups to a device which is not managed correctly by my kernel. Maybe I miss something in the kernel configuration or I need another solution? The filesystem I use is ext3.

Output from lsusb is:

Bus 001 Device 003: ID 0bc2:0502 Seagate RSS LLC

My kernel:

Linux backup 2.6.14-gentoo-r6 #1 SMP PREEMPT Tue Jan 3 11:26:09 CET 2006 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux

Part of corresponding logs:

Feb  3 10:33:47 [kernel] usb 1-2: new high speed USB device using ehci_hcd and address 5

Feb  3 10:33:47 [kernel] scsi4 : SCSI emulation for USB Mass Storage devices

Feb  3 10:33:47 [kernel] usb-storage: device found at 5

Feb  3 10:33:47 [kernel] usb-storage: waiting for device to settle before scanning

Feb  3 10:33:53 [kernel]   Vendor: ST340083  Model: 2A                Rev: 3.03

Feb  3 10:33:53 [kernel]   Type:   Direct-Access                      ANSI SCSI revision: 00

Feb  3 10:33:53 [kernel] SCSI device sdd: 781422768 512-byte hdwr sectors (400088 MB)

Feb  3 10:33:53 [kernel] sdd: assuming drive cache: write through

Feb  3 10:33:53 [kernel] SCSI device sdd: 781422768 512-byte hdwr sectors (400088 MB)

Feb  3 10:33:53 [kernel] sdd: assuming drive cache: write through

Feb  3 10:33:53 [kernel] Attached scsi disk sdd at scsi4, channel 0, id 0, lun 0

Feb  3 10:33:53 [kernel] Attached scsi generic sg4 at scsi4, channel 0, id 0, lun 0,  type 0

Feb  3 10:33:53 [kernel] usb-storage: device scan complete

Feb  3 10:37:30 [kernel] kjournald starting.  Commit interval 5 seconds

Feb  3 10:37:30 [kernel] EXT3-fs: mounted filesystem with ordered data mode.

Feb  3 10:39:31 [kernel] usb 1-1: reset high speed USB device using ehci_hcd and address 3

                - Last output repeated 272 times -

Feb  3 13:01:10 [kernel] usb 1-2: reset high speed USB device using ehci_hcd and address 5

Feb  3 13:01:11 [kernel] usb 1-1: reset high speed USB device using ehci_hcd and address 3

                - Last output repeated 74 times -

Feb  3 13:43:31 [kernel] usb 1-2: reset high speed USB device using ehci_hcd and address 5

Feb  3 13:44:02 [kernel] usb 1-1: reset high speed USB device using ehci_hcd and address 3

                - Last output repeated 121 times -

Feb  3 14:55:47 [kernel] usb 1-2: reset high speed USB device using ehci_hcd and address 5

Feb  3 14:56:20 [kernel] usb 1-1: reset high speed USB device using ehci_hcd and address 3

                - Last output repeated 50 times -

Feb  3 15:24:39 [kernel] kjournald starting.  Commit interval 5 seconds

Feb  3 15:24:39 [kernel] EXT3 FS on sdc2, internal journal

Feb  3 15:24:39 [kernel] EXT3-fs: mounted filesystem with ordered data mode.

Feb  3 15:25:19 [kernel] usb 1-1: reset high speed USB device using ehci_hcd and address 3

                - Last output repeated 66 times -

Feb  3 16:16:00 [kernel] usb 1-2: USB disconnect, address 5

I would really appreciate any suggestions.

----------

## Telemin

Are you using the low performance usb driver, if so switch to the usual scsi emulated drive the low performance driver really is what it says!

----------

## Januszzz

Do you mean if I use "Low performance USB block driver"? No, I do not use it, as "enabling it cripples the usb-storage driver."

Well I double-checked kernel config and really found nothing serious. I've also tried linux-usb.org pages and still didn't get satisfactory reply. Only that  I have to change my usb cables, which I have brand new and working. But in fact I did change for a shorter ones, it didn't help either  :Sad: 

----------

## Marctraider

Hello, i recently bought a 2.5 inch external little case for my 1gb laptop hard disk to connect to usb/firewire.

When i first bought it, it worked fine, the first time i plugged it in my friends pc it worked great. I didnt copy big files or whatever yet.

Then i tried it on a pentium 3 with the gentoo livecd to check whether the hard drive has bad sectors (i used badblocks /dev/sda)

After a long while it was done, no bad sectors.

(it was quite a slow progress because the pentium 3 had only usb 1.1 but it worked fine non-the-less.

Now when i was home i tried it on my own box, when i begin copying stuff to it with kde it begins to copy good, after 10 secs it stalls.

Then it goes on for some secs, again 10 secs stall or something.

meanwhile i watched the dmesg, it also gives me like 10 messages like usb device reset.

I dont have the exact message right away so i'll post it later...

Oh yeah, on windows computers it all seems to be fine, i copy big files and it goes smooth, also i formatted it full with fat32 and it went smooth.

(the livecd kernel is? I have no idea, i think 2.6.12 or something. On my computer it is 2.6.14 (ck-sources).

----------

## Januszzz

Ok, until my previous post I haven't found good solution, but I've received some answers on linux-usb-users mailing list.

They say those errors are from cables, bad devices and so on, and the kernel is ok. I completely disagree, because Windows does good job in the same place. By the way, cables could be an issue in your situation, because I've found that some of front-panel usb ports are now working correctly (Windows also crashes). Windows also copies files about 20% slower (at my tests)

After a lot of tests I found that the most important issue (for me) is speed of the copying process. When I slow it down from 25MB/s to 20 it goes fine. How to do this? Well - I've got 1GB lan connection and I slow it using htb, mounted usb drive remotely... and it works flawlessly. You can also use 100MB lan of course, the speed should be 10MB/s.

If I were you I would pass the question to Alan Stern on http://www.linux-usb.org/. I assume in his opinion would be sth like you have broken drivers or poor drives, but you can always give a shot. You may also check my email and answers an the list, maybe you will find an answer there.

Januszzz.

----------

## Marctraider

Well, im going to mess around with fstab and stuff, async, sync, etcetera.

Also im going to change kernels to see if its the kernel or not.

It's working GREAt in windows so its NOT the cables   :Very Happy: 

----------

## Marctraider

Never mind this ... I'm going to use firewire on my own box... stupid USB  :Mad: 

----------

## fangorn

I Second that. 

Have a laptop, if you move the USB mouse it is possible the USB bus gets resetted in complete and you loose connection to your mounted filesystems on the USB HDD  :Evil or Very Mad:  Never again any SIS chipset  :Exclamation:  (or never again a laptop without PS2 connector  :Twisted Evil:  )

BTW. on this chipset my external HDD drives get recognized by windows only half of the time, linux at least can see them  :Rolling Eyes: 

----------

## Marctraider

Well, i have a sis 745 chipset, but the problem i have is not because the chipset sucks, its the damn chip in the external enclosure 2.5inch...

The only problem i have with sis is that i get apic errors... but disabling apic solves it  :Smile: 

----------

