使用某些 USB 扩展坞时无法读取高级格式磁盘上的内容

使用某些 USB 扩展坞时无法读取高级格式磁盘上的内容

我有 Linux Mint 17.3(基于 Ubuntu 14.04),内核为 4.4.0。我有一块 Western Digital Caviar Green WD10EARX 硬盘,容量为 1TB。此硬盘上的标签显示它是“高级格式”硬盘。请注意,没有设置跳线,因此没有设置“兼容性”/“模拟”跳线。

我阅读了有关高级格式驱动器及其 4k 扇区大小(而不是标准的 512 字节大小)的信息,但我无法解释的是,每当我将此驱动器与不同的 USB 外壳或扩展坞连接时看到的不同行为。

示例 1:Sunplus USB 2 扩展坞

lsusb -v 显示:

Bus 003 Device 013: ID 1bcf:0c31 Sunplus Innovation Technology Inc. SPIF30x Serial-ATA bridge
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1bcf Sunplus Innovation Technology Inc.
  idProduct          0x0c31 SPIF30x Serial-ATA bridge
  bcdDevice            1.32
  iManufacturer           1 Sunplus Innovation Technology 
  iProduct                2 USB to Serial-ATA bridge
  iSerial                 3 <removed>
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 Bulk Only Configuration
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              5 Bulk Only Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

fdisk -l 显示:

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 testine, 63 settori/tracce, 121601 cilindri, totale 1953525168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x0001cf00

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sdb1            8040      498023      244992   fd  Autorilevamento raid di Linux
/dev/sdb2          498024      562271       32124   fd  Autorilevamento raid di Linux
/dev/sdb3          562272      809271      123500   fd  Autorilevamento raid di Linux
/dev/sdb4          809272   244187999   121689364   fd  Autorilevamento raid di Linux

hdparm -I 显示:

ATA device, with non-removable media
        Model Number:       WDC WD10EARX-00N0YB0                    
        Serial Number:      <removed>
        Firmware Revision:  51.0AB51
        Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Supported: 8 7 6 5 
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors: 1953525168
        Logical  Sector size:                   512 bytes
        Physical Sector size:                  4096 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:      953869 MBytes
        device size with M = 1000*1000:     1000204 MBytes (1000 GB)
        cache/buffer size  = unknown
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, with device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 0
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    NOP cmd
           *    DOWNLOAD_MICROCODE
                Power-Up In Standby feature set
           *    SET_FEATURES required to spinup after power up
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    NCQ priority information
                DMA Setup Auto-Activate optimization
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Write Same (AC2)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
                unknown 206[7]
                unknown 206[12] (vendor specific)
                unknown 206[13] (vendor specific)
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        186min for SECURITY ERASE UNIT. 186min for ENHANCED SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 50014ee2b14805a5
        NAA             : 5
        IEEE OUI        : 0014ee
        Unique ID       : 2b14805a5
Checksum: correct

如果我猫/sys/class/block/sdb/queue/physical_block_size/sys/class/block/sdb/queue/logical_block_size他们都说512。

因此,当将硬盘连接到该扩展坞时,它看起来就像一个普通的 512 字节扇区驱动器。

示例 2:带有 JMicron USB 转 SATA 和 PATA 组合桥的 USB 2 外壳

当将驱动器连接到该外壳时,我看到了完全不同的故事。

lsusb -v 显示:

Bus 003 Device 014: ID 152d:2338 JMicron Technology Corp. / JMicron USA Technology Corp. JM20337 Hi-Speed USB to SATA & PATA Combo Bridge
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x152d JMicron Technology Corp. / JMicron USA Technology Corp.
  idProduct          0x2338 JM20337 Hi-Speed USB to SATA & PATA Combo Bridge
  bcdDevice            1.00
  iManufacturer           1 JMicron
  iProduct                2 USB to ATA/ATAPI bridge
  iSerial                 5 <removed>
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 USB Mass Storage
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              6 MSC Bulk-Only Transfer
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

fdisk -l 显示:

Nota: la dimensione del settore è 4096 (non 512)
(in English: Note: the sector size is 4096 (not 512)

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 testine, 63 settori/tracce, 15200 cilindri, totale 244190646 settori
Unità = settori di 1 * 4096 = 4096 byte
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Identificativo disco: 0x0001cf00

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sdb1            8040      498023     1959936   fd  Autorilevamento raid di Linux
/dev/sdb2          498024      562271      256992   fd  Autorilevamento raid di Linux
/dev/sdb3          562272      809271      988000   fd  Autorilevamento raid di Linux
/dev/sdb4          809272   244187999   973514912   fd  Autorilevamento raid di Linux

hdparm 产生某种损坏的结果:

ATA device, with non-removable media
        Model Number:       �����������@������������
        Serial Number:      ������������
        Firmware Revision:  �����
Standards:
        Used: unknown (minor revision code 0x10fd) 
        Supported: 14 11 10 
        Likely used: 14
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(may be)(cannot be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Vendor
        R/W multiple sector transfer: Max = 255 Current = 255
        Recommended acoustic management value: 234, current value: 0
        DMA: not supported
        PIO: unknown
             Cycle time: no flow control=65535ns  IORDY flow control=24384ns
           *    reserved 69[0]
           *    reserved 69[1]
           *    reserved 69[2]
           *    reserved 69[4]
           *    reserved 69[7]
           *    DEVICE CONFIGURATION SET/IDENTIFY DMA commands
Security: 
        Master password revision code = 19648
        not     supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
        not     supported: enhanced erase
Integrity word not set (found 0x0000, expected 0x9fa5)

如果我猫/sys/class/block/sdb/queue/physical_block_size/sys/class/block/sdb/queue/logical_block_size他们都说4096。

因此,看起来这个机箱使用了 4k 扇区大小的磁盘,因此是“原生”4k 高级格式驱动器。如果我要在这里停下来,我会说另一个扩展坞“太旧”了,无法正确支持 4k 驱动器。然而,让我感到惊讶的是以下内容。

示例 3:JMicron USB 3 扩展坞

当我将此驱动器连接到更新的 USB 3 扩展坞(支持 UASP)时,我得到的结果与第一个扩展坞更为相似。

lsusb -v 显示:

Bus 004 Device 006: ID 152d:0565 JMicron Technology Corp. / JMicron USA Technology Corp. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x152d JMicron Technology Corp. / JMicron USA Technology Corp.
  idProduct          0x0565 
  bcdDevice            1.01
  iManufacturer           1 JMicron
  iProduct                2 JMS56x Series
  iSerial                 5 <removed>
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          121
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 USB Mass Storage
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              6 MSC Bulk-Only Transfer
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface             10 MSC BOT/UAS Transfer
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-out pipe (0x04)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000f0e
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat          32 micro seconds
Device Status:     0x000d
  Self Powered
  U1 Enabled
  U2 Enabled

fdisk -l 显示:

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 testine, 63 settori/tracce, 121601 cilindri, totale 1953525168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Identificativo disco: 0x0001cf00

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sdb1            8040      498023      244992   fd  Autorilevamento raid di Linux
/dev/sdb2          498024      562271       32124   fd  Autorilevamento raid di Linux
/dev/sdb3          562272      809271      123500   fd  Autorilevamento raid di Linux
/dev/sdb4          809272   244187999   121689364   fd  Autorilevamento raid di Linux

hdparm -I 显示:

ATA device, with non-removable media
        Model Number:       WDC WD10EARX-00N0YB0                    
        Serial Number:      <removed>
        Firmware Revision:  51.0AB51
        Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Supported: 8 7 6 5 
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors: 1953525168
        Logical  Sector size:                   512 bytes
        Physical Sector size:                  4096 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:      953869 MBytes
        device size with M = 1000*1000:     1000204 MBytes (1000 GB)
        cache/buffer size  = unknown
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, with device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 0
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    NOP cmd
           *    DOWNLOAD_MICROCODE
                Power-Up In Standby feature set
           *    SET_FEATURES required to spinup after power up
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    NCQ priority information
                DMA Setup Auto-Activate optimization
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Write Same (AC2)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
                unknown 206[7]
                unknown 206[12] (vendor specific)
                unknown 206[13] (vendor specific)
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        186min for SECURITY ERASE UNIT. 186min for ENHANCED SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 50014ee2b14805a5
        NAA             : 5
        IEEE OUI        : 0014ee
        Unique ID       : 2b14805a5
Checksum: correct

如果我猫/sys/class/block/sdb/queue/physical_block_size/sys/class/block/sdb/queue/logical_block_size他们都说512。

因此,有了这个扩展坞,我再次将驱动器视为“正常”的 512 字节扇区驱动器。

问题

  1. /sys/class/block/sdb/queue/physical_block_size为什么 hdparm 和 fdisk 以及+/sys/class/block/sdb/queue/logical_block_size在两个扩展坞中显示的内容不同?hdparm 表示物理扇区大小为 4096,而另一个表示物理扇区大小为 512(与逻辑扇区大小相同)
  2. 为什么最新的(2018 年购买的)USB 3 扩展坞带有支持最新 UASP 协议的 JMicron 桥接器,却无法将驱动器视为 4k 驱动器,而 JMicron 的旧款 USB 2 SATA+PATA 桥接器却能将驱动器视为 4k 驱动器?如果我现在从头开始将这个硬盘与这些扩展坞一起使用,这会不会是个问题?
  3. 如您所见,该驱动器上的分区是 RAID 成员(RAID1);分区表和 RAID 阵列是在磁盘与 JMicron SATA+PATA 外壳一起使用时创建的。每当我尝试使用此外壳启动 RAID 阵列时,我都不会遇到任何问题,并且可以读取磁盘上的内容;每当我尝试对两个扩展坞执行相同操作时,我都会收到“未找到超级块错误”,因此阵列无法启动,我无法读取磁盘内容;这让我有点害怕,因为我担心如果外壳有一天出现故障,我将无法读取该磁盘的内容

为了克服问题 3。我记得即使在使用第一个扩展坞时,我也可以通过调整块起始和扇区大小来 dd 感兴趣的分区,这样我就可以获得一个文件映像,可以将其作为环回设备安装并取回原始内容,但是我想知道是否有一个更简单的解决方案,不会强迫我创建整个磁盘的映像。

相关内容