Opened 11 years ago

Last modified 11 months ago

#9655 new bug

External usb hard disk with switch doesn't work/mount properly

Reported by: Giova84 Owned by: mmlr
Priority: normal Milestone: R1
Component: Drivers/Disk/USB Version: R1/Development
Keywords: External usb hard disk with switch doesn't work properly spindown mount Cc:
Blocked By: Blocking:
Platform: x86

Description

Here i have an external usb disk. And i have found two issues, utilizing it under Haiku. Are both related to power on. The first: this external hdd has a power switch. in Haiku, when I turn on this hdd, it doesn't appear in the list of mountables drives. To do this i have to unplug the usb cable, turn on the hdd and reattach the cable: in this way the hdd will be available. This problem doesn't occurs under Windows 7 and under Linux.

The second issue is always related to power management: this hdd provide the spindown feature (after about 15 minutes of inactivity, the hdd automatically power off itself, and when i access again to disk, the hdd turn on again automatically) So, under all other operating system this operation between power off and power on happens instantly, but under Haiku takes some seconds of delay (eg when i open the Tracker inside this hard disk).

I have also noticed that when i write data to this hdd, Tracker takes more CPU.

hrev 45349 and i have noticed this on every Haiku revision.

PS: I have added this Ticket under "Tracker" category just because under Servers category ain't available "mount_server".

Change History (15)

comment:1 by anevilyak, 11 years ago

Component: Applications/TrackerDrivers/USB
Owner: changed from axeld to mmlr

comment:2 by anevilyak, 11 years ago

A syslog and listusb output would be helpful here, otherwise there's no information to actually diagnose/troubleshoot this with.

comment:3 by Giova84, 11 years ago

listusb report the disk as: 174c:55aa /dev/bus/usb/6/3 "ASMedia Technology Inc." "ASMedia 2105 SATA bridge" ver. 0100

In the exactly moment when i turn on the hard disk, inside syslog appears these messages:

KERN: usb hub 32: port 3: device removed KERN: usb hub 32: port 3: new device connected KERN: usb_disk: device reports a lun count of 1 KERN: usb_disk: vendor_identification "ASMT " KERN: usb_disk: product_identification "2105 " KERN: usb_disk: product_revision_level "0 " KERN: usb_disk: got device name: "ASMT 2105 0 " = No error

As i've said when i turn on the hard disk, doesn't appear under mount menu but is available under listusb.

When i unplug the disk and then replug (and in this way is available under mount menu), in syslog i can read:

KERN: usb error ehci -1: KERN: qtd (0x6aa8800) error: 0x001f8049 KERN: usb_disk: sending the command block wrapper failed KERN: usb error ehci -1: qtd (0x6aa8980) error: 0x00080248 KERN: usb error ehci -1: qtd (0x6aa8b80) error: 0x00080248 KERN: usb error ehci -1: qtd (0x6aa8d80) error: 0x00080248 KERN: usb_disk: got device name: "ASMT 2105 0 " = No error KERN: Media removed from /dev/disk/usb/2/0/raw KERN: usb hub 32: port 3: device removed KERN: usb hub 32: KERN: port 3: new device connected KERN: usb_disk: device reports a lun count of 1 KERN: usb_disk: vendor_identification "ASMT " KERN: usb_disk: product_identification "2105 " KERN: usb_disk: product_revision_level "0 " KERN: usb_disk: got device name: "ASMT 2105 0 " = No error KERN: KDiskDeviceManager::_ScanPartition(/dev/disk/usb/2/0/raw) KERN: intel: ep_std_ops(0x1) KERN: trying: partitioning_systems/intel/extended/v1 KERN: returned: -1 KERN: intel: ep_std_ops(0x2) KERN: trying: partitioning_systems/intel/map/v1 KERN: intel: pm_identify_partition(14, 12: 0, 250059350016, 512) KERN: returned: 0.81 KERN: trying: partitioning_systems/efi_gpt/v1 KERN: returned: -1 KERN: trying: file_systems/bfs/v1 KERN: returned: -1 KERN: trying: file_systems/devfs/v1 KERN: returned: -1 KERN: trying: file_systems/rootfs/v1 KERN: returned: -1 KERN: trying: partitioning_systems/amiga_rdb/v1 KERN: returned: -1 KERN: trying: partitioning_systems/apple/v1 KERN: returned: -1 KERN: trying: partitioning_systems/session/v1 KERN: returned: -1 KERN: trying: file_systems/attribute_overlay/v1 KERN: returned: -1 KERN: trying: file_systems/btrfs/v1 KERN: [34mbtrfs:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/cdda/v1 KERN: usb_disk: unhandled ioctl 10102 KERN: returned: -1 KERN: trying: file_systems/exfat/v1 KERN: [34mexfat:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/ext2/v1 KERN: [34mext2:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/fat/v1 KERN: returned: -1 KERN: googlefs: std_ops(INIT) KERN: trying: file_systems/googlefs/v1 KERN: returned: -1 KERN: googlefs: std_ops(UNINIT) KERN: trying: file_systems/iso9660/v1 KERN: identify(14, 0xdf4806f0) KERN: returned: -1 KERN: trying: file_systems/nfs/v1 KERN: returned: -1 KERN: trying: file_systems/ntfs/v1 KERN: fs_identify_partition: boot signature NTFS doesn't match KERN: returned: -1 KERN: trying: file_systems/reiserfs/v1 KERN: returned: -1 KERN: trying: file_systems/udf/v1 KERN: udf_recognize: Invalid sequence. status = -1 KERN: returned: -1 KERN: trying: file_systems/write_overlay/v1 KERN: returned: -1 KERN: scanning with: partitioning_systems/intel/map/v1 KERN: intel: pm_scan_partition(14, 12: 0, 250059350016, 512) KERN: KDiskDeviceManager::_ScanPartition(/dev/disk/usb/2/0/0) KERN: intel: ep_std_ops(0x1) KERN: trying: partitioning_systems/intel/extended/v1 KERN: intel: ep_identify_partition(14, 1048576, 250058113024, 512) KERN: returned: -1 KERN: intel: ep_std_ops(0x2) KERN: trying: partitioning_systems/intel/map/v1 KERN: intel: pm_identify_partition(14, 13: 1048576, 250058113024, 512) KERN: returned: -1 KERN: trying: partitioning_systems/efi_gpt/v1 KERN: returned: -1 KERN: trying: file_systems/bfs/v1 KERN: returned: -1 KERN: trying: file_systems/devfs/v1 KERN: returned: -1 KERN: trying: file_systems/rootfs/v1 KERN: returned: -1 KERN: trying: partitioning_systems/amiga_rdb/v1 KERN: returned: -1 KERN: trying: partitioning_systems/apple/v1 KERN: returned: -1 KERN: trying: partitioning_systems/session/v1 KERN: returned: -1 KERN: trying: file_systems/attribute_overlay/v1 KERN: returned: -1 KERN: trying: file_systems/btrfs/v1 KERN: [34mbtrfs:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/cdda/v1 KERN: usb_disk: unhandled ioctl 10102 KERN: returned: -1 KERN: trying: file_systems/exfat/v1 KERN: [34mexfat:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/ext2/v1 KERN: [34mext2:[0m invalid superblock! KERN: returned: -1 KERN: trying: file_systems/fat/v1 KERN: returned: -1 KERN: googlefs: std_ops(INIT) KERN: trying: file_systems/googlefs/v1 KERN: returned: -1 KERN: googlefs: std_ops(UNINIT) KERN: trying: file_systems/iso9660/v1 KERN: identify(14, 0xdf1339c0) KERN: returned: -1 KERN: trying: file_systems/nfs/v1 KERN: returned: -1 KERN: trying: file_systems/ntfs/v1 KERN: returned: 0.8 KERN: trying: file_systems/reiserfs/v1 KERN: returned: -1 KERN: trying: file_systems/udf/v1 KERN: udf_recognize: Invalid sequence. status = -1 KERN: returned: -1 KERN: trying: file_systems/write_overlay/v1 KERN: returned: -1 KERN: scanning with: file_systems/ntfs/v1 KERN: fs_mount - EXIT, result code is No error

comment:4 by phoudoin, 11 years ago

It's an USB3 to SATA3 bridge/dock, right? Do you connect it on an USB3 port or an USB2 one?

A quick googling on this vendor/product IDs returns several issues under Linux a few months ago too, so my bet is that this device don't behave as one will expect, USB disk driver included.

comment:5 by Giova84, 11 years ago

Hi Phoudoin, Yes: this ext box is USB3 to SATA3. But in anyway i'm also using this device under Ubuntu and Fedora without any issue.

Version 0, edited 11 years ago by Giova84 (next)

comment:6 by phoudoin, 11 years ago

Could you post listusb -v /dev/bus/usb/6/3 output at two distincts times:

  • when you turn on power
  • when, already powered on, you unplug then replug the USB connector.

Assuming that you use always the same USB HUB port to connect your device, otherwise adapt the /dev/bus/usb/6/3 to what make sense.

Thanks.

comment:7 by Giova84, 11 years ago

At power on:

Ϟ 19:00:52 Ϟ ~ listusb -v /dev/bus/usb/6/3
[Device /dev/bus/usb/6/3]
    Class .................. 0x00 (Per-interface classes)
    Subclass ............... 0x00
    Protocol ............... 0x00
    Max Endpoint 0 Packet .. 64
    USB Version ............ 0x0210
    Vendor ID .............. 0x174c (ASMedia Technology Inc.)
    Product ID ............. 0x55aa (ASMedia 2105 SATA bridge)
    Product Version ........ 0x0100
    Manufacturer String .... "asmedia"
    Product String ......... "ASMT1051"
    Serial Number .......... "00000000000000000000"
    [Configuration 0]
        Configuration String . ""
        [Interface 0]
            [Alternate 0 active]
                Class .............. 0x08 (Mass storage)
                Subclass ........... 0x06
                Protocol ........... 0x50
                Interface String ... ""
                [Endpoint 0]
                    MaxPacketSize .... 512
                    Interval ......... 0
                    Type ............. Bulk
                    Direction ........ Input
                [Endpoint 1]
                    MaxPacketSize .... 512
                    Interval ......... 0
                    Type ............. Bulk
                    Direction ........ Output

At unplug and replug:

Ϟ 19:02:08 Ϟ ~ listusb -v /dev/bus/usb/6/3
[Device /dev/bus/usb/6/3]
    Class .................. 0x00 (Per-interface classes)
    Subclass ............... 0x00
    Protocol ............... 0x00
    Max Endpoint 0 Packet .. 64
    USB Version ............ 0x0210
    Vendor ID .............. 0x174c (ASMedia Technology Inc.)
    Product ID ............. 0x55aa (ASMedia 2105 SATA bridge)
    Product Version ........ 0x0100
    Manufacturer String .... "asmedia"
    Product String ......... "ASMT1051"
    Serial Number .......... "00000000000000000000"
    [Configuration 0]
        Configuration String . ""
        [Interface 0]
            [Alternate 0 active]
                Class .............. 0x08 (Mass storage)
                Subclass ........... 0x06
                Protocol ........... 0x50
                Interface String ... ""
                [Endpoint 0]
                    MaxPacketSize .... 512
                    Interval ......... 0
                    Type ............. Bulk
                    Direction ........ Input
                [Endpoint 1]
                    MaxPacketSize .... 512
                    Interval ......... 0
                    Type ............. Bulk
                    Direction ........ Output

Seem identical.

comment:8 by Giova84, 11 years ago

Just now i have noticed a very odd thing: This Disk is named as "Ext", so under Haiku is "/Ext". Ok, i have downloaded an Haiku nightly image in tar.xz format inside this disk. When i attempt to open the file, clicking on expand or just for see the content of the file with Zip-O-Matic, the external disk will auto unmount! Yes: no alert was displayed. The Disk just disappears from the screen and from Mount list. So i have to mount it again in the same way: unplug and replug the disk. This was happened for two times. And now, in "recents folder" under Deskbar i can see: /Ext, /Ext1 and /Ext2! /Ext and /Ext1 are just marked as folders, which both contains a folder named "_HaikuAutoCreated" which is empty. /Ext2, leads to the disk itself.

comment:9 by phoudoin, 11 years ago

Seems like the usb_disk driver have issue to keep a stable communication with your device. The _HaikuAutoCreated folder is the sign that the volume was actually successfully mounted, but the fact that it disappear as soon as you do actual access on it is bad news regarding usb_disk <-> device link.

I've myself an USB3/SATA dock, I've not test it under Haiku. Maybe our usb_disk is broken for such device, or, my fear, some USB3/SATA adapters have some unexpected behavior that our usb_disk driver or SCSI layer don't handle fine yet.

Googling your device's ID seems to show that it was not yet working fine under Linux circa 2012's summer, so I suspect that some quirk were made since. Question is which one(s)?

comment:10 by Giova84, 11 years ago

In anyway, to be complete, for the rest i have no issues with this disk: yesterday i have also downloaded a 4 Gb file without problems. I can also read properly files (for hours) from this disk (which also contains my music collection). But every time that i open a zip file, under Haiku, the disk will auto unmount/disappear! And i can confirm you again that under Linux works properly (i have also tried with an old revision of Ubuntu from September, and the disk works like a charm.

comment:11 by mmlr, 11 years ago

There's really no mystery as to the power button here. The usb_disk driver is a really simple driver that supports a subset of SCSI, just enough to get most USB mass storage devices going. It is not a SCSI module and does not share code with the SCSI layer. It eventually needs to be rewritten to be such a module, but for this to happen the USB stack itself has to be brought to the new device API. Noone has done that work yet, as it's kind of non trivial.

In any case, usb_disk does not support spin up/down. It does not attempt to power the disk on when a new device is attached. It assumes that when a device is connected and enumerating a LUN, the backing device is powered already. This assumption holds for pretty much every USB stick and most card readers or similar devices. It usually holds for external USB disks as well, but breaks in the case of your device.

The delay you mention in bringing the device back up once it has spun down comes from the same limitation. The usb_disk driver does not recognise the fact that the disk is not powered anymore and does not take action to bring it back up. Instead it simply sees this case as a generic error and initiates a normal mass storage reset. In the case of your device it seems like that also powers the disk back on (this is implementation dependent). The reset procedure does however take a lot longer than a simple spin up would, that's where the delay you see comes from.

I don't have an explanation for the "unmount on opening a zip file" problem, it is probably unrelated to usb_disk. The behaviour you describe sounds more like a filesystem problem causing the volume to be uncleanly unmounted on an error. Re-opening a file from that disk could then cause the volume to be auto mounted again. If it was a usb_disk error that caused the device to vanish, there would be no volume to be mounted anymore. Please provide a syslog snippet so this can be verified and possibly open a new ticket if it clearly is a filesystem error.

comment:12 by korli, 10 years ago

Please check with a current nightly.

comment:13 by Giova84, 10 years ago

hrev46447 these issues described in the ticket and in the comment:8 are still present.

comment:14 by waddlesplash, 5 years ago

Component: Drivers/USBDrivers/Disk/USB

comment:15 by waddlesplash, 11 months ago

Please retest after hrev57051.

Note: See TracTickets for help on using tickets.