# USB disk on ehci disconnect on high use

## sirkubax

Hi, 

I have a problem with my usb hdd drive. It disconnect on high load. 

I'm going yo try now this:

http://superuser.com/questions/176959/external-usb-drive-is-failing/208759#208759

http://ubuntuforums.org/showthread.php?t=163716

But I found some strange behavior:

```

[    9.013604] scsi 4:0:0:0: Direct-Access     WD       DM001 External   1.65 PQ: 0 ANSI: 4

[    9.019149] khelper used greatest stack depth: 4872 bytes left

[    9.019362] sd 4:0:0:0: Attached scsi generic sg4 type 0

[    9.019844] sd 4:0:0:0: [sde] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[    9.020715] sd 4:0:0:0: [sde] Write Protect is off

[    9.020803] sd 4:0:0:0: [sde] Mode Sense: 21 00 00 00

[    9.020805] sd 4:0:0:0: [sde] Assuming drive cache: write through

[    9.022215] sd 4:0:0:0: [sde] Assuming drive cache: write through

[    9.022309]  sde: sde1 sde2 sde3 sde4 < sde5 >

[    9.068720] sd 4:0:0:0: [sde] Assuming drive cache: write through

[    9.068806] sd 4:0:0:0: [sde] Attached SCSI disk

------

[43596.628727] usb 1-5: USB disconnect, address 2

[43596.632242] REISERFS abort (device sde5): Journal write error in flush_commit_list

[43596.643309] md/raid:md127: read error not correctable (sector 208764408 on sde3).

[43596.643312] md/raid:md127: Disk failure on sde3, disabling device.

[43596.643313] <1>md/raid:md127: Operation continuing on 4 devices.

[43601.443114] md: md127: recovery done.

[43610.060006] usb 1-5: new high speed USB device using ehci_hcd and address 3

[43610.175987] usb 1-5: New USB device found, idVendor=1058, idProduct=1100

[43610.175990] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[43610.175991] usb 1-5: Product: My Book         

[43610.175993] usb 1-5: Manufacturer: Western Digital 

[43610.175994] usb 1-5: SerialNumber: 5332343032444A5820202020202020

[43610.176519] scsi5 : usb-storage 1-5:1.0

[43618.177690] scsi 5:0:0:0: Direct-Access     WD       DM001 External   1.65 PQ: 0 ANSI: 4

[43618.177943] sd 5:0:0:0: Attached scsi generic sg4 type 0

[43618.179428] sd 5:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[43618.180177] sd 5:0:0:0: [sdf] Write Protect is off

[43618.180179] sd 5:0:0:0: [sdf] Mode Sense: 21 00 00 00

[43618.180180] sd 5:0:0:0: [sdf] Assuming drive cache: write through

[43618.181550] sd 5:0:0:0: [sdf] Assuming drive cache: write through

[43618.181553]  sdf: sdf1 sdf2 sdf3 sdf4 < sdf5 >

[43618.206554] sd 5:0:0:0: [sdf] Assuming drive cache: write through

[43618.206556] sd 5:0:0:0: [sdf] Attached SCSI disk

[43618.486706] md: export_rdev(sdf3)

[43618.553834] md: export_rdev(sdf3)
```

The most funny thing - one of partition is still mounted and accessible as "old disk" (/dev/sde5), while the disk is already visible as a new device (/dev/sdf) 

```

matrix ~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

rootfs                 14G  2.9G   12G  21% /

/dev/root              14G  2.9G   12G  21% /

rc-svcdir             1.0M   52K  972K   6% /lib64/rc/init.d

cgroup_root            10M     0   10M   0% /sys/fs/cgroup

udev                   10M  248K  9.8M   3% /dev

shm                   2.0G     0  2.0G   0% /dev/shm

/dev/md127            5.4T  5.2T  263G  96% /vservers

/dev/sde5             466G   12G  455G   3% /mnt/500GB_NO_RAID_BACKUP

matrix ~ # fdisk -l /dev/sde

matrix ~ # fdisk -l /dev/sdf

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sdf1   *           1        1824    14651248+  fd  Linux raid autodetect

/dev/sdf2            1825        2322     4000185   fd  Linux raid autodetect

/dev/sdf3            2323      182401  1446484567+  fd  Linux raid autodetect

/dev/sdf4          182402      243201   488376000    5  Extended

/dev/sdf5          182402      243201   488375968+  8

matrix ~ # ls /mnt/500GB_NO_RAID_BACKUP/etc/

DIR_COLORS            cron.monthly        env.d            group-     issue.logo    login.defs          man.conf     mysql               pam.d        rc.conf         sandbox.d  shells       timezone

adjtime               cron.weekly         environment      host.conf  kernel        logrotate.d         mc           nanorc              passwd       resolv.conf     screenrc   skel         udev

bash                  crontab             etc-update.conf  hosts      ld.so.cache   mail                mdadm.conf   networks            passwd-      revdep-rebuild  securetty  ssh          vim

ca-certificates       csh.env             filesystems      init.d     ld.so.conf    mailcap             mdev.conf    nscd.conf           php          rmt             security   ssl          vservers

ca-certificates.conf  default             fstab            inittab    ld.so.conf.d  make.conf           mime.types   nsswitch.conf       portage      rpc             services   ssmtp        wgetrc

conf.d                dispatch-conf.conf  gai.conf         inputrc    local.d       make.conf.catalyst  mke2fs.conf  openvpn             profile      rsyncd.conf     sgml       sysctl.conf  xinetd.d

cron.daily            e2fsck.conf         gentoo-release   iproute2   locale.gen    make.globals        modprobe.d   openvpn-matrix.tar  profile.env  runlevels       shadow     syslog-ng    xml

cron.hourly           eclean              group            issue      localtime     make.profile        mtab         opt                 protocols    sandbox.conf    shadow-    terminfo     zabbix

matrix ~ # cat /mnt/500GB_NO_RAID_BACKUP/etc/issue

This is \n.\O (\s \m \r) \t

3  Linux

matrix ~ #  blkid 

/dev/sdb1: UUID="4330c3f1-89bb-ff07-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdb2: UUID="3fc5c043-7384-7a62-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdb3: UUID="6659854b-3eb4-c9cf-0489-4333532a878b" TYPE="linux_raid_member" 

/dev/sdd1: UUID="4330c3f1-89bb-ff07-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdd2: UUID="3fc5c043-7384-7a62-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdd3: UUID="6659854b-3eb4-c9cf-0489-4333532a878b" TYPE="linux_raid_member" 

/dev/sda1: UUID="4330c3f1-89bb-ff07-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sda2: UUID="3fc5c043-7384-7a62-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sda3: UUID="6659854b-3eb4-c9cf-0489-4333532a878b" TYPE="linux_raid_member" 

/dev/sdc1: UUID="4330c3f1-89bb-ff07-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdc2: UUID="3fc5c043-7384-7a62-a4d2-adc226fd5302" TYPE="linux_raid_member" 

/dev/sdc3: UUID="6659854b-3eb4-c9cf-0489-4333532a878b" TYPE="linux_raid_member" 

/dev/md127: UUID="702cf3c4-0603-43de-bb3b-a4e0b213d8d7" TYPE="reiserfs" 

/dev/md2: UUID="413c88ce-3b07-4bd1-8dc1-59adc63319fd" TYPE="swap" 

/dev/md1: UUID="35ce872d-bb97-4ede-9936-fc54f095dc58" TYPE="reiserfs" 

/dev/sdf3: UUID="6659854b-3eb4-c9cf-0489-4333532a878b" TYPE="linux_raid_member" 

/dev/sdf5: UUID="1690014f-3d47-479f-a701-9c0ec47053b5" TYPE="reiserfs"

```

I wonder why i still can access /dev/sde5 (/mnt/500GB_NO_RAID_BACKUP)

It might be the thing, that major/minor numbers are the same, but I'm not sure

```
matrix dev # ls -l sd*

brw-rw---- 1 root disk 8,  0 Mar 13 11:58 sda

brw-rw---- 1 root disk 8,  1 Mar 13 11:58 sda1

brw-rw---- 1 root disk 8,  2 Mar 13 11:58 sda2

brw-rw---- 1 root disk 8,  3 Mar 13 11:58 sda3

brw-rw---- 1 root disk 8, 16 Mar 13 11:58 sdb

brw-rw---- 1 root disk 8, 17 Mar 13 11:58 sdb1

brw-rw---- 1 root disk 8, 18 Mar 13 11:58 sdb2

brw-rw---- 1 root disk 8, 19 Mar 13 11:58 sdb3

brw-rw---- 1 root disk 8, 32 Mar 13 11:58 sdc

brw-rw---- 1 root disk 8, 33 Mar 13 11:58 sdc1

brw-rw---- 1 root disk 8, 34 Mar 13 11:58 sdc2

brw-rw---- 1 root disk 8, 35 Mar 13 11:58 sdc3

brw-rw---- 1 root disk 8, 48 Mar 13 11:58 sdd

brw-rw---- 1 root disk 8, 49 Mar 13 11:58 sdd1

brw-rw---- 1 root disk 8, 50 Mar 13 11:58 sdd2

brw-rw---- 1 root disk 8, 51 Mar 13 11:58 sdd3

brw-rw---- 1 root disk 8, 80 Mar 13 23:05 sdf

brw-rw---- 1 root disk 8, 81 Mar 13 23:05 sdf1

brw-rw---- 1 root disk 8, 82 Mar 13 23:05 sdf2

brw-rw---- 1 root disk 8, 83 Mar 13 23:05 sdf3

brw-rw---- 1 root disk 8, 84 Mar 13 23:05 sdf4

brw-rw---- 1 root disk 8, 85 Mar 13 23:05 sdf5
```

Any idea's  :Smile: 

My max sectors write settings is 240 now, i'm going down to 64, I'll give you a note later

```
matrix ~ # cat /sys/block/sdf/device/max_sectors 

240
```

----------

## DaggyStyle

is it builtin or modules? have you enabled other [oxu]hci drivers?

----------

## sirkubax

Hi, 

Thanks for reply

It's currently built-in, but I'm 99% sure I had the same problem with modules (and i built them in to check it it will help).

I may compile "to much" into kernel, cause I was not sure what i will need to lunch USB disk

```
matrix disk.dd # modprobe -l

kernel/arch/x86/kernel/test_nx.ko

kernel/drivers/scsi/pm8001/pm8001.ko

kernel/drivers/scsi/scsi_wait_scan.ko

kernel/drivers/net/mii.ko

kernel/drivers/net/bonding/bonding.ko

kernel/drivers/net/dummy.ko

kernel/drivers/net/tun.ko

kernel/drivers/net/r8169.ko

kernel/net/netfilter/xt_recent.ko

matrix disk.dd # cat /usr/src/linux/.config |grep HCI

CONFIG_SATA_AHCI=y

CONFIG_SATA_AHCI_PLATFORM=y

CONFIG_USB_ARCH_HAS_OHCI=y

CONFIG_USB_ARCH_HAS_EHCI=y

CONFIG_USB_XHCI_HCD=y

# CONFIG_USB_XHCI_HCD_DEBUGGING is not set

CONFIG_USB_EHCI_HCD=y

CONFIG_USB_EHCI_ROOT_HUB_TT=y

# CONFIG_USB_EHCI_TT_NEWSCHED is not set

CONFIG_USB_OHCI_HCD=y

# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set

# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set

CONFIG_USB_OHCI_LITTLE_ENDIAN=y

CONFIG_USB_UHCI_HCD=y

# CONFIG_USB_WHCI_HCD is not set

CONFIG_PROVIDE_OHCI1394_DMA_INIT=y

matrix linux # cat /usr/src/linux/.config |grep  -v not |grep USB

# USB Network Adapters

# USB-based Watchdog Cards

# USB Input Devices

CONFIG_USB_SUPPORT=y

CONFIG_USB_ARCH_HAS_HCD=y

CONFIG_USB_ARCH_HAS_OHCI=y

CONFIG_USB_ARCH_HAS_EHCI=y

CONFIG_USB=y

CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

# Miscellaneous USB options

CONFIG_USB_DEVICEFS=y

CONFIG_USB_DEVICE_CLASS=y

CONFIG_USB_DYNAMIC_MINORS=y

# USB Host Controller Drivers

CONFIG_USB_XHCI_HCD=y

CONFIG_USB_EHCI_HCD=y

CONFIG_USB_EHCI_ROOT_HUB_TT=y

CONFIG_USB_OHCI_HCD=y

CONFIG_USB_OHCI_LITTLE_ENDIAN=y

CONFIG_USB_UHCI_HCD=y

# USB Device Class drivers

# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may

# also be needed; see USB_STORAGE Help for more info

CONFIG_USB_STORAGE=y

CONFIG_USB_STORAGE_USBAT=y

CONFIG_USB_STORAGE_CYPRESS_ATACB=y

CONFIG_USB_LIBUSUAL=y

# USB Imaging devices

# USB port drivers

# USB Miscellaneous drivers

```

I'm now waiting for some task to complete, and I'm gonna try on max_sectors next...

----------

## DaggyStyle

I had a disconnection issue with usb when modules were built into the kernel, compiling them as modules fixed it, maybe it will help.

btw, do you really need all of them?

run lspci -k, see which are in use and remove the unused ones.

----------

## sirkubax

Well, 

My raid crashed, I tried to repair reiserfs partition (reiserfsck) but it took 7 days and 1 TB out of 5 was done, so i gave up.

Now my disk is not in use, i will try to check it later with max_count flag later.

----------

## v_andal

Well, I have 2 external USB disks. They also periodically "get lost". In my case, the disks are small, so checking happens very fast. After searching around, I had to come to conclusion, that it might be some hardware problem that may have something to do with power supply. So I believe that using external USB disks (at least those without extra power supply) for something running for long time is not a good thing. So I use them mostly for storing data with infrequent use.

----------

## sirkubax

echo 64 > /sys/block/sde/device/max_sectors

That was the help with disconneting disk

----------

## Ant P.

I've had lots of problems with USB-powered hard disks. Sometimes plugging them into a different port or using a shorter cable is enough to fix it.

They're usually just SATA underneath so plugging them in directly would work best, but then you have to get them out of the enclosure...

----------

