#57 Can't use hdparm on AF drive behind USB bridge

open
nobody
None
5
2015-11-04
2013-03-30
Tom Maneiro
No

I've just bought a Seagate Barrauca 7200.14 2TB drive (ST2000DM001-9YN164), which is one of those new Advanced Format drives (512byte logical/4KB physical sectors), I'm using it with a USB-to-SATA converter, powered by a JMicron bridge chip, which according to lsusb it's:
ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge

This chip does something really neat: whenever it detects one of those AF drives, it exposes to the host the full 4K physical sectors, according to this kernel log:
[455142.656082] usb 1-5: new high-speed USB device number 9 using ehci_hcd
[455142.789119] usb 1-5: New USB device found, idVendor=152d, idProduct=2338
[455142.789128] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[455142.789134] usb 1-5: Product: USB to ATA/ATAPI bridge
[455142.789139] usb 1-5: Manufacturer: JMicron
[455142.789144] usb 1-5: SerialNumber: 000000000000
[455142.790109] scsi6 : usb-storage 1-5:1.0
[455143.789059] scsi 6:0:0:0: Direct-Access ST2000DM 001-9YN164 PQ: 0 ANSI: 2 CCS
[455143.792440] sd 6:0:0:0: Attached scsi generic sg1 type 0
[455143.792757] sd 6:0:0:0: [sdc] 488378646 4096-byte logical blocks: (2.00TB/1.81 TiB)
[455143.793491] sd 6:0:0:0: [sdc] Write Protect is off
[455143.793499] sd 6:0:0:0: [sdc] Mode Sense: 28 00 00 00
[455143.794242] sd 6:0:0:0: [sdc] No Caching mode page present
[455143.794248] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[455143.795248] sd 6:0:0:0: [sdc] 488378646 4096-byte logical blocks: (2.00 TB/1.81 TiB)
[455143.797250] sd 6:0:0:0: [sdc] No Caching mode page present
[455143.797258] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[455143.802889] sdc: unknown partition table
[455143.804873] sd 6:0:0:0: [sdc] 488378646 4096-byte logical blocks: (2.00 TB/1.81 TiB)
[455143.806377] sd 6:0:0:0: [sdc] No Caching mode page present
[455143.806384] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[455143.806390] sd 6:0:0:0: [sdc] Attached SCSI disk
I guess that this improves performance (no need to translate between 512/4K LBAs), and also is a workaround for the 2TiB MBR limit (so you can use the HDD with Windows XP, for example). Unfortunately some applications don't seem to like this neat feature, and sadly hdparm is the first one that I've noticed.

What I'm trying to do with this drive is to turn off APM. Seagate, in its infinite wisdom decided to ship all their new Barracudas from factory with APM set to 128, which causes constant head parking. This not only kills performance, but can also potentially kill your drive early (or trip SMART warnings too soon since load/unload cycle number is very limited). Guess that it's far more important for Seagate to save those extra 2 watts on your monthly electricity bill so you can buy a new HDD from them once the current one fails... Normally I would do hdparm -B 255 /dev/sdbarracuda... except that it doesn't work with this bridged setup. Even a simple -I command fails with this:
# hdparm --verbose -I /dev/sdb

/dev/sdb:
outgoing cdb: 85 08 0e 00 00 00 01 00 00 00 00 00 00 40 ec 00
SG_IO: ATA_16 status=0x2, host_status=0x0, driver_status=0x8
SG_IO: sb[]: 72 00 00 1d 00 00 00 0e 09 0c 00 00 00 00 39 47 00 ee 00 d3 e0 50
00 00 00 00 00 00 00 00 00 00
incoming_data: 00 00 00 00 00 00 00 00 00 00 00 00 fe 01 00 00 a8 fb bf 00 00
ea ff ff 00 e6 bf 00 00 ea ff ff 38 e6 bf 00 00 ea ff ff 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: desc[]: 09 0c 00 00 00 00 39 47 00 ee 00 d3 e0 50
ATA_16 stat=50 err=00 nsect=00 lbal=47 lbam=ee lbah=d3 dev=e0

ATA device, with non-removable media
Serial Number: ������8���
Standards:
Likely used: 1
Configuration:
Logical max current
cylinders 0 0
heads 0 0
sectors/track 510 0
--
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 0 MBytes
device size with M = 1000*1000: 0 MBytes
cache/buffer size = unknown
Capabilities:
IORDY not likely
Cannot perform double-word IO
R/W multiple sector transfer: not supported
DMA: not supported
PIO: pio0

The drive works nicely with other applications (smartmontools under Win64/Debian, CrystalDiskInfo under Windows) using the very same setup. hdparm works perfectly with this USB bridge when used with non-AF drives (tested with several old Samsungs, including a real ancient PATA 8GB drive when used with a PATA-to-SATA bridge board, and with a Hitachi Travelstar 5K160-160 drive):
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-4-amd64] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.14 (AF)
Device Model: ST2000DM001-9YN164
Serial Number: Z2Fxxxxx
LU WWN Device Id: 5 000c50 xxxxxxxxx
Firmware Version: CC4H
User Capacity: 2.000.398.934.016 bytes [2,00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
Local Time is: Wed Mar 27 15:17:41 2013 VET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

If I use another bridge that doesn't do this translation (for example, I borrowed a Sunplus-based USB-to-SATA converter which exposes 512b sectors), hdparm partially works... it can ID the drive, but it throws sense errors and bad checksums at every single command! (and of course I can't turn off APM on this stupid drive!). At first I've thought on some bug on my distro-packed version (Debian Wheezy AMD64, which ships with 9.39), so I went here, downloaded the 9.43 tarball and built it... just to be faced with the same problem.

Due to Seagate stubborness, APM must be turned off on every cold boot, since the drive firmware (CC4H as of today) doesn't allow to turn it off permanently. So far my only workaround is to reboot to Windows, and use CrystalDiskInfo to turn APM off, but since I spend most of my time on Debian, obviously this is unacceptable. Yeah, I know, I should have avoided buying Seagate drives... but in my country we had no other options.

Discussion

  • pekseg

    pekseg - 2015-10-31

    any update on this?

    under raspberry pi, I get the same:

    hdparm -I /dev/sda

    /dev/sda:
    SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    ATAPI Medium changer, with non-removable media
    Model Number: ´AòÄ´rLü´Ñ ´a´0Ü´œ´L
    Serial Number: Š8´FÌ ´%«Ì´o‹X´þL´!
    Firmware Revision: ´L%è´Rý
    Standards:
    Likely used: 3
    Configuration:
    DRQ response: unknown.
    Packet size: 12 bytes
    cache/buffer size = unknown
    Capabilities:
    IORDY(may be)(cannot be disabled)
    Buffer size: 23060.5kB bytes avail on r/w long: 19628
    DMA: not supported
    PIO: pio0

    USB-SATA case with id 067b:2773 is used.

     
  • Mark Lord

    Mark Lord - 2015-11-04

    No idea why the bridge (or is it Linux kernel SCSI layer?) treats one drive different from another. hdparm treats them all the same.

    So very unlikely to be an issue in hdparm itself, though perhaps a workaround could be invented for it to make things work. That won't happen unless I have the exact same hardware here to test with though.

    Cheers
    Mark

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks