# usb-storage problem

## Ulukay

hoi, i got a big problem with my external usb 2.0 hdd

i tried already 2 different pcs (athlon xp2800/kt333 and p4 ht/i865)

2 different kernels (2.4.25, 2.6.4-pre mm sources)

and many different cables

the hardware is working perfectly, because i can use the ext. hdd in windows without any problems (i moved already ~200gigs with this drive)

here is what i get in linux

on connect:

```

usb 1-2: new high speed USB device using address 3

scsi3 : SCSI emulation for USB Mass Storage devices

  Vendor: ST360021  Model: A                 Rev: 0811

  Type:   Direct-Access                      ANSI SCSI revision: 02

SCSI device sdb: 117231408 512-byte hdwr sectors (60022 MB)

sdb: assuming drive cache: write through

 /dev/scsi/host3/bus0/target0/lun0: p1

Attached scsi disk sdb at scsi3, channel 0, id 0, lun 0

Attached scsi generic sg3 at scsi3, channel 0, id 0, lun 0,  type 0

USB Mass Storage device found at 3

```

then i mount the drive, and e.g. try to copy something

after a few minutes (or seconds) the copy process "freezes" for about 2mins and then i get an I/O error

here is what kern.log is telling me:

```

Mar  5 14:39:34 sunnyserver scsi: Device offlined - not ready after error recovery: host 3 channel 0 id 0 lun 0

Mar  5 14:39:34 sunnyserver SCSI error : <3 0 0 0> return code = 0x50000

Mar  5 14:39:34 sunnyserver end_request: I/O error, dev sdb, sector 358631

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358568

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358569

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358570

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358571

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358572

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358573

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358574

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358575

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358576

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver Buffer I/O error on device sdb1, logical block 358577

Mar  5 14:39:34 sunnyserver lost page write due to I/O error on sdb1

Mar  5 14:39:34 sunnyserver SCSI error : <3 0 0 0> return code = 0x70000

Mar  5 14:39:34 sunnyserver end_request: I/O error, dev sdb, sector 358759

Mar  5 14:39:34 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:34 sunnyserver FAT: bread(block 129) in fat_access failed

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:35 sunnyserver scsi3 (0:0): rejecting I/O to offline device

.

.

.

MANY of them ;)

.

.

Mar  5 14:39:36 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:36 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:43 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 14:39:43 sunnyserver FAT: Directory bread(block 28648) failed

```

----------

## Ulukay

i tried with ext2:

```

Mar  5 15:32:40 sunnyserver scsi: Device offlined - not ready after error recovery: host 3 channel 0 id 0 lun 0

Mar  5 15:32:40 sunnyserver SCSI error : <3 0 0 0> return code = 0x50000

Mar  5 15:32:40 sunnyserver end_request: I/O error, dev sdb, sector 104961479

Mar  5 15:32:40 sunnyserver printk: 425844 messages suppressed.

Mar  5 15:32:40 sunnyserver Buffer I/O error on device sdb1, logical block 13120181

Mar  5 15:32:40 sunnyserver lost page write due to I/O error on sdb1

Mar  5 15:32:40 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:32:40 sunnyserver scsi3 (0:0): rejecting I/O to offline device

..

many

..

Mar  5 15:32:40 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:32:41 sunnyserver Buffer I/O error on device sdb1, lorejecting I/O to offline device

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

..

many

..

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:32:41 sunnyserver buffer layer error at fs/buffer.c:1266

Mar  5 15:32:41 sunnyserver Call Trace:

Mar  5 15:32:41 sunnyserver [<c0152ad8>] mark_buffer_dirty+0x48/0x50

Mar  5 15:32:41 sunnyserver [<c01cce0f>] ext2_sync_super+0x3f/0x60

Mar  5 15:32:41 sunnyserver [<c01cbc6c>] ext2_error+0xac/0xe0

Mar  5 15:32:41 sunnyserver [<c0152ed5>] __bread+0x35/0x40

Mar  5 15:32:41 sunnyserver [<c01ca736>] ext2_get_inode+0x116/0x130

Mar  5 15:32:41 sunnyserver [<c01caaf9>] ext2_update_inode+0x49/0x350

Mar  5 15:32:41 sunnyserver [<c01701e6>] write_inode+0x46/0x50

Mar  5 15:32:41 sunnyserver [<c01704a9>] __sync_single_inode+0x2b9/0x320

Mar  5 15:32:41 sunnyserver [<c01c9299>] ext2_discard_prealloc+0x59/0x90

Mar  5 15:32:41 sunnyserver [<c0170752>] sync_sb_inodes+0x192/0x260

Mar  5 15:32:41 sunnyserver [<c0170873>] writeback_inodes+0x53/0xb0

Mar  5 15:32:41 sunnyserver [<c0138f6b>] background_writeout+0x7b/0xc0

Mar  5 15:32:41 sunnyserver [<c013972d>] __pdflush+0xed/0x1d0

Mar  5 15:32:41 sunnyserver [<c0139810>] pdflush+0x0/0x20

Mar  5 15:32:41 sunnyserver [<c013981f>] pdflush+0xf/0x20

Mar  5 15:32:41 sunnyserver [<c0138ef0>] background_writeout+0x0/0xc0

Mar  5 15:32:41 sunnyserver [<c0139810>] pdflush+0x0/0x20

Mar  5 15:32:41 sunnyserver [<c012de05>] kthread+0xa5/0xb0

Mar  5 15:32:41 sunnyserver [<c012dd60>] kthread+0x0/0xb0

Mar  5 15:32:41 sunnyserver [<c0106989>] kernel_thread_helper+0x5/0xc

Mar  5 15:32:41 sunnyserver

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:32:41 sunnyserver EXT2-fs error (device sdb1): ext2_get_inode: unable to read inode block - inode=6619138, block=13238274

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

..

many

..

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:32:41 sunnyserver EXT2-fs error (device sdb1): ext2_free_branches: Read failure, inode=6619138, block=13253646

Mar  5 15:32:41 sunnyserver scsi3 (0:0): rejecting I/O to offline device

..

many

..

Mar  5 15:33:00 sunnyserver scsi3 (0:0): rejecting I/O to offline device

Mar  5 15:33:00 sunnyserver printk: 1178 messages suppressed.

Mar  5 15:33:00 sunnyserver Buffer I/O error on device sdb1, logical block 0

Mar  5 15:33:00 sunnyserver lost page write due to I/O error on sdb1

```

----------

## Ulukay

lsusb is telling me:

Bus 001 Device 002: ID 05e3:0702 Genesys Logic, Inc.

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 Interface

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        64

  idVendor           0x05e3 Genesys Logic, Inc.

  idProduct          0x0702

  bcdDevice            0.02

  iManufacturer           2 Genesyslogic

  iProduct                3 USB Mass Storage Device

  iSerial                 0

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           32

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0xc0

      Self Powered

    MaxPower                4mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           2

      bInterfaceClass         8 Mass Storage

      bInterfaceSubClass      6 SCSI

      bInterfaceProtocol     80 Bulk (Zip)

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize        512

        bInterval               1

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x02  EP 2 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               none

        wMaxPacketSize        512

        bInterval               1

  Language IDs: (length=4)

     0409 English(US)

----------

## jdoe

are you on nforce2 ?? i've a similare problem with a usb-to-IDE adapter, which I use for moving files from my rec studio to home. On win i've used it and i've no problem, but on linux the transfer freezes and the I/O error, like. I've been told it's a nforce issue... bah...

John

----------

## Ulukay

 *Ulukay wrote:*   

> 
> 
> i tried already 2 different pcs (athlon xp2800/kt333 and p4 ht/i865)
> 
> 

 

http://www.qbik.ch/usb/devices/showdev.php?id=2383

----------

## brenden

I've been having the same problem.  Try disabling usbfs and acpi.

----------

## Ulukay

 *brenden wrote:*   

> I've been having the same problem.  Try disabling usbfs and acpi.

 

no effect  :Sad: 

but i found: http://www.qbik.ch/usb/devices/showdev.php?id=2383

----------

## elpollodiablo

the same thing happens to me if i use the usb2.0!!! if i connect my hdd to the  usb1 port on my hub, the transfer works (but is so damn slow....)

----------

## markuslk

Similar problems here, I've got a MAP-H31x Series enclosure for my Samsung 160GB harddisk with USB 2.0 connector.

[little OT]

When I start the disk at boot time and boot into winxp, my hdd is set up right when i log in and I've got no problems while accessing/moving data. When I turn it on while XP's running, my disk sometimes needs 3 times of ON/OFF to get recognized by the os....

[/OT]

With gentoo-2.6.5 (and all the kernels before) I've the same problem that my harddisk begins to "pump" after several minutes or even a few hours... it sounds like a unhealthily spin down/spin up while transferring data. 

Then I can't umount the drive properly and most of the times I'd to reboot by pressing the button   :Sad:   because X/KDE freezed.

I thought that it might be a problem with my Samsung Drive (only 1/2 year old).

Which external cases are working fine with linux? I'll try out the cheapest external case which I might find on ebay next week, but your experiences with working cases/chips would help me anyway  :Very Happy: 

Greetings

Markus

----------

## RoYzter

glad to see that i am not the only one having problems... i bought an icybox 350u (english page doesn't work...) and a seagate 200gb hdd. the enclosure has a prolific 2507 chip which (according to this page) should work ok.

if i disable usb 2.0 support in the bios of my msi hermes 651 barebone system (SiS 651 chipset), it works without any problems (except for the slow usb 1.1 speed). but if usb 2.0 is enabled, it starts getting weird...

it seems that transfers first get buffered and if the buffer is full the system nearly freezes (no network traffic possible, everything very slow). top shows over 80% of my cpu waiting, but i can't identify which process is eating everything up. it has to be something usb/external hdd related though.

```

top - 02:27:34 up 13:17,  1 user,  load average: 2.71, 0.96, 0.54

Tasks:  70 total,   1 running,  69 sleeping,   0 stopped,   0 zombie

Cpu(s): 12.0% us,  4.0% sy,  0.0% ni,  0.0% id, 83.9% wa,  0.0% hi,  0.0% si

Mem:    484156k total,   481180k used,     2976k free,   109168k buffers

Swap:   506036k total,    10616k used,   495420k free,   222884k cached

```

if i wait long enough, everything gets in order again... just to give you an example what long enough means: copying 50mb takes nearly 3 minutes to finish (even usb 1.1 is supposed to be faster!)

```

# time dd if=/dev/zero of=/dev/sda2 bs=1M count=50

50+0 records in

50+0 records out

real    2m50.744s

user    0m0.001s

sys     0m0.288s

```

here is a part of /var/log/messages:

```

Apr 11 21:32:43 cassiopeia usb 1-1: new high speed USB device using address 3

Apr 11 21:32:43 cassiopeia scsi1 : SCSI emulation for USB Mass Storage devices

Apr 11 21:32:43 cassiopeia Vendor: ST320082  Model: 2A                Rev: 3.01

Apr 11 21:32:43 cassiopeia Type:   Direct-Access                      ANSI SCSI revision: 02

Apr 11 21:32:43 cassiopeia SCSI device sda: 390721969 512-byte hdwr sectors (200050 MB)

Apr 11 21:32:43 cassiopeia sda: assuming drive cache: write through

Apr 11 21:32:44 cassiopeia /dev/scsi/host1/bus0/target0/lun0: p1 p2

Apr 11 21:32:44 cassiopeia Attached scsi disk sda at scsi1, channel 0, id 0, lun 0

Apr 11 21:32:44 cassiopeia Attached scsi generic sg0 at scsi1, channel 0, id 0, lun 0,  type 0

Apr 11 21:32:44 cassiopeia USB Mass Storage device found at 3

Apr 11 21:32:44 cassiopeia scsi.agent[20871]: disk at /devices/pci0000:00/0000:00:03.3/usb1/1-1/1-1:1.0/host1/1:0:0:0

Apr 11 21:32:44 cassiopeia modprobe: FATAL: Module sd_mod already in kernel.

```

i didn't yet really test if it works ok when using windoze... gonna try this tomorrow

anyway... can somebody help me please?

thx in advance

[edit] corrected "copying 100mb" to "copying 50mb"  :Smile:  so it's even worse! [/edit]

----------

## kottlettstanze

hi,

same troubles here as well. disabling usbfs and acpi (and apic, hint from a different thread) didn't solve it either.

In the moment I'm using the 2.6.5 kernel. Using a 2.4.? kernel I could sort of solve the problem by giving the ehci_hcd module the parameter:

```
log2_irq_thresh=6
```

That made it slow (because it waits then), but stable. This doesn't work for the 2.6.5 kernel  :Sad: 

any other ideas? and why the hell is it working with m$?

cheers,

    Kevin

----------

## kurifu

This is actually a well known problem... many people appear to be trying to figure out what is actually causing this, and though there was a bug fix in kernel 2.6.4 which managed to make its way past the 0 length messages the hardware was sending (invalidly) to the mass storage driver, there are objviously other issues that need to be ironed out.

You can follow up more closly at this url: http://www.mail-archive.com/linux-usb-devel%40lists.sourceforge.net/msg20692.html

Any help anyone can provide with debugging this, well I am sure we would all appreciate it.

----------

## thepi

i had the same problem, but found no solution. so i returned the disk for refund.

later, i found this. 

it's actually for genesys devices, but maybe it helps. in my case the copying would freeze tho, i had to turn off the whole external hdd. as far as i understand it the usb chip on the hdd case had a data overflow (i.e. the data came in too fast).

hth, never mind if it adresses a totally different issue.

pi~

----------

## kottlettstanze

This one did the trick for me:

http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg26639.html

Using gentoo-dev-sources 2.6.8, I just wrote 3.9GB to the usb disk without error. The speed is okay as well (between 10 and 15 MB/s).

The patch tool doesn't like to do the patch (too much differences), but it is easy to do manually.

Would be great if the patch was included in the gentoo-dev-sources  :Mr. Green: 

cheers,

Kevin

----------

