Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Big harddrive doesn't work (reported 1TB instead of 4TB)
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sat Jun 03, 2023 7:17 am    Post subject: Big harddrive doesn't work (reported 1TB instead of 4TB) Reply with quote

Hi All,

I'm using an external 4TB harddrive for my backups. To make a backup i simply attach the drive and run a script to make the backup on the disk, this drive is used with 7 different systems, all running Gentoo.

On my most recent system i'm having problems using it, this is what dmesg says about it:
Code:

[ 3268.803578] usb 2-1: new SuperSpeed USB device number 4 using xhci_hcd
[ 3268.835364] usb 2-1: New USB device found, idVendor=152d, idProduct=2509, bcdDevice= 1.00
[ 3268.835384] usb 2-1: New USB device strings: Mfr=1, Product=11, SerialNumber=3
[ 3268.835394] usb 2-1: Product: SHARKOON COMBO
[ 3268.835401] usb 2-1: Manufacturer: JMicron
[ 3268.835408] usb 2-1: SerialNumber: 00A1234567D0
[ 3268.837624] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 3268.838194] scsi host2: usb-storage 2-1:1.0
[ 3269.884006] scsi 2:0:0:0: Direct-Access     SHARKOON COMBO            0000 PQ: 0 ANSI: 5
[ 3269.884504] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 3269.885438] sd 2:0:0:0: [sdb] 2147484931 512-byte logical blocks: (1.10 TB/1.00 TiB)
[ 3269.886233] sd 2:0:0:0: [sdb] Write Protect is off
[ 3269.886248] sd 2:0:0:0: [sdb] Mode Sense: 28 00 00 00
[ 3269.886773] sd 2:0:0:0: [sdb] No Caching mode page found
[ 3269.886787] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 3269.888234] sd 2:0:0:0: [sdb] 2147483649 512-byte logical blocks: (1.10 TB/1.00 TiB)
[ 3269.889132] sdb: detected capacity change from 2147484931 to 2147483649

It may not look too bad, but this is a 4TB drive, not 1TB. All my other systems report this:
Code:

[5272797.012207] usb 3-3: new SuperSpeed USB device number 5 using xhci_hcd
[5272797.051682] usb-storage 3-3:1.0: USB Mass Storage device detected
[5272797.052044] scsi host2: usb-storage 3-3:1.0
[5272798.092186] scsi 2:0:0:0: Direct-Access     SHARKOON COMBO            0000 PQ: 0 ANSI: 5
[5272798.092967] sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
[5272798.093215] sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[5272798.094700] sd 2:0:0:0: [sdc] Write Protect is off
[5272798.094709] sd 2:0:0:0: [sdc] Mode Sense: 28 00 00 00
[5272798.096227] sd 2:0:0:0: [sdc] No Caching mode page found
[5272798.096233] sd 2:0:0:0: [sdc] Assuming drive cache: write through
[5272798.154941]  sdc: sdc1
[5272798.155270] sd 2:0:0:0: [sdc] Attached SCSI disk

I've had similar problems before with a raspberry pi where i tried to use the same disk, but i don't remember the solution :oops:.

Does anyone know how to solve this?
With some internet searches i can only find references some kernel configuration option regarding to big block devices which doesn't exist anymore.

Thanks in advance.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sat Jun 03, 2023 7:44 am    Post subject: Reply with quote

pa4wdh,

Either something does not understand 48bit LBA or you have GPT support missing in the kernel, or both.

I suspect the former as it goes wrong on hardware detection.
Code:
[5272797.012207] usb 3-3: new SuperSpeed USB device number 5 using xhci_hcd
[5272797.051682] usb-storage 3-3:1.0: USB Mass Storage device detected
[5272797.052044] scsi host2: usb-storage 3-3:1.0
[5272798.092186] scsi 2:0:0:0: Direct-Access     SHARKOON COMBO            0000 PQ: 0 ANSI: 5
[5272798.092967] sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
[5272798.093215] sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)


When it goes wrong the
Code:
[5272798.092967] sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
is missing and it not god as far as reading partition tables.
Also the error case says
Code:
[ 3269.884504] sd 2:0:0:0: Attached scsi generic sg1 type 0

That's the wrong sort of device too.

Are you moving the drive between PCs including the USB to SATA bridge?
That's important as some USB to SATA bridge adaptors have odd limits because they cannot pass all SCSI commands.

Does the odd box have CONFIG_BLK_DEV_SD=y in the kernel?
Its not needed for nvme ... but USB attached storage requires it. That may be why the Attached scsi generic appears in dmesg.
While you are checking the kernel
Code:
CONFIG_USB_UAS=y
is a very good thing for USB3, so you might want to check for that.
Its not the cause of the problem but it allows DMA, NCQ and all those other go faster things over USB3, as long as its USB3 all the way.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sat Jun 03, 2023 10:40 am    Post subject: Reply with quote

NeddySeagoon wrote:

Either something does not understand 48bit LBA or you have GPT support missing in the kernel, or both.

I came to a similar conclusion.
GPT is enabled (CONFIG_EFI_PARTITION=y), internal SSD is also partitioned with GPT because it boots with UEFI (i would have preferred legacy, but the system's BIOS can't do that anymore).
So far i've diff'ed the CONFIG_BLK, CONFIG_SCSI and CONFIG_USB options without success.

Quote:

When it goes wrong the
Code:
[5272798.092967] sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
is missing and it not god as far as reading partition tables.

That's what i've been focusing on so far, even checking the code of drivers/scsi/sd.c to see the conditions that trigger it. There is no related CONFIG_ variable which made be think compile time configuration is not the problem.

Quote:
Also the error case says
Code:
[ 3269.884504] sd 2:0:0:0: Attached scsi generic sg1 type 0

That's the wrong sort of device too.

Yep. I think that's because it can't properly read the partition table because of the incorrect detected size. Smaller devices (USB sticks) work ok, i don't have smaller sata devices available to attach to the bridge.

Quote:
Are you moving the drive between PCs including the USB to SATA bridge?
That's important as some USB to SATA bridge adaptors have odd limits because they cannot pass all SCSI commands.

Yes, i only move the USB connector from one PC to another, also tried USB2.0 and USB3.0 ports with no difference.

Quote:
Does the odd box have CONFIG_BLK_DEV_SD=y in the kernel?
Its not needed for nvme ... but USB attached storage requires it. That may be why the Attached scsi generic appears in dmesg.

Yes, it is also used by the internal sata disk (1TB samsung 870 EVO).

Quote:
While you are checking the kernel
Code:
CONFIG_USB_UAS=y
is a very good thing for USB3, so you might want to check for that.
Its not the cause of the problem but it allows DMA, NCQ and all those other go faster things over USB3, as long as its USB3 all the way.

I can give it a try, but the usb-sata bridge predates UAS and on other systems i've worked with UAS gave me more problems than joy :). It's also disabled on the other machines where the disk works properly.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sat Jun 03, 2023 11:40 am    Post subject: Reply with quote

I just recompiled my kernel with UAS support, there is no difference.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sat Jun 03, 2023 12:22 pm    Post subject: Reply with quote

pa4wdh,

Lets check the partition table in both good and bad conditions.
I don't think it that but it will rule another thing out.

Do
Code:
fdisk -l -t dos /dev/...
and
Code:
fdisk -l -t gpt  /dev/...
on both systems.

On the 'bad' system I'm expecting fdisk to warn that there is at least one partition off the end of the device and complain that it cannot read the backup partition table.
On no account let it write anything.

-t dos should show
Code:
Device     Boot Start        End    Sectors Size Id Type
/dev/sda1           1 4294967295 4294967295   2T ee GPT
as that's the protective MSDOS table that shows type 0xee to tell that its a fake and GPT in is use.
Its 2T as that is the most that the MSDOS partition table can describe. That's from an 8T drive.

I expect the GPT to read correctly ... other than the warnings in the 'bad' system.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sat Jun 03, 2023 1:55 pm    Post subject: Reply with quote

I've never liked the jmicron controllers, I usually try and avoid them (too much trouble in the past compared to asmedia)

I suppose it would be easy to grab the config files from both machines, 1 working, 1 not and strip out comments and look for differences in these areas
SCSI, BLK, USB
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sat Jun 03, 2023 5:23 pm    Post subject: Reply with quote

Thanks for you help Neddy.

NeddySeagoon wrote:

Do
Code:
fdisk -l -t dos /dev/...
and
Code:
fdisk -l -t gpt  /dev/...
on both systems.


Good:
Code:
Working:
pc12 ~ # fdisk -l -t dos /dev/sdc
Disk /dev/sdc: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: COMBO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdc1           1 4294967295 4294967295   2T ee GPT
pc12 ~ # fdisk -l -t gpt /dev/sdc
Disk /dev/sdc: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: COMBO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 77441E8F-17B4-43B6-9A37-8883F483ECE5

Device     Start        End    Sectors  Size Type
/dev/sdc1   2048 7814037134 7814035087  3.6T Linux filesystem


Bad:
Code:
pc18 ~ # fdisk -l -t dos /dev/sdb
Disk /dev/sdb: 1 TiB, 1099511628288 bytes, 2147483649 sectors
Disk model: COMBO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdb1           1 4294967295 4294967295   2T ee GPT
pc18 ~ # fdisk -l -t gpt /dev/sdb
Disk /dev/sdb: 1 TiB, 1099511628288 bytes, 2147483649 sectors
Disk model: COMBO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Quote:
On the 'bad' system I'm expecting fdisk to warn that there is at least one partition off the end of the device and complain that it cannot read the backup partition table.
On no account let it write anything.

Other than the output above there are no warnings whatsoever.

Quote:
I've never liked the jmicron controllers, I usually try and avoid them (too much trouble in the past compared to asmedia)

So far it has been serving me well for many years.

Quote:
I suppose it would be easy to grab the config files from both machines, 1 working, 1 not and strip out comments and look for differences in these areas
SCSI, BLK, USB

Which was my initial idea too, but that didn't give any useful results.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sat Jun 03, 2023 6:53 pm    Post subject: Reply with quote

I would try another usb port (even a usb 2 port just to see if it changes the recognition of the drive), if you haven't tried that already.

What does lspci say about USB on the machine that doesn't work, as well as one machine that does.

I had a problem in the past where the kernel didn't like the usb controller on the MB, it added some funny quirks, and disabled some of the use of it.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sat Jun 03, 2023 7:24 pm    Post subject: Reply with quote

pa4wdh,

Code:
idVendor=152d, idProduct=2509
That leads to a JMicron USB to SATA2 bridge chip.
It can do USB2 or USB3 but its bulk mode only. It does not understand UAS.

The protective MSDOS partition table is correct. All 2TB of it.
The GPT is certainly there, just not displayed.

I'm with Anon-E-moose on the avoidance of JMicron.

While all of this is interesting, its not progressing the solution to your issue.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sat Jun 03, 2023 8:54 pm    Post subject: Reply with quote

What type machine is the one that doesn't work with the drive. Model, mb make, etc, the key may be there.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 7:28 am    Post subject: Reply with quote

The motherboard is an ASRock J5040-ITX: https://www.asrock.com.tw/mb/Intel/J5040-ITX/index.nl.asp
The actual SoC on there is an Intel J5040: https://www.intel.com/content/www/us/en/products/sku/197304/intel-pentium-silver-j5040-processor-4m-cache-up-to-3-20-ghz/specifications.html
The USB controller according to lspci: 00:15.0 USB controller: Intel Corporation Celeron/Pentium Silver Processor USB 3.0 xHCI Controller (rev 06)

USB Topology when the drive is connected:
Code:
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/7p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/9p, 480M
    |__ Port 5: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
    |__ Port 6: Dev 3, If 0, Class=Hub, Driver=hub/2p, 480M


USB device list:
Code:
Bus 001 Device 003: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. USB2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation xHCI Host Controller
Bus 002 Device 002: ID 152d:2509 JMicron Technology Corp. / JMicron USA Technology Corp. JMS539, JMS551 SATA 3Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation xHCI Host Controller


lsusb -v for the USB-SATA bridge (https://en.sharkoon.com/product/13760)
Code:
Bus 002 Device 002: ID 152d:2509 JMicron Technology Corp. / JMicron USA Technology Corp. JMS539, JMS551 SATA 3Gb/s bridge
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         9
  idVendor           0x152d JMicron Technology Corp. / JMicron USA Technology Corp.
  idProduct          0x2509 JMS539, JMS551 SATA 3Gb/s bridge
  bcdDevice            1.00
  iManufacturer           1 JMicron
  iProduct               11 SHARKOON COMBO
  iSerial                 3 00A1234567D0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x002c
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      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
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x002a
  bNumDeviceCaps          3
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      HIRD 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
  Container ID Device Capability:
    bLength                20
    bDescriptorType        16
    bDevCapabilityType      4
    bReserved               0
    ContainerID             {03020100-0504-0706-0800-000000000000}
Device Status:     0x0001
  Self Powered

_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sun Jun 04, 2023 8:02 am    Post subject: Reply with quote

pa4wdh,

I suspect its kernel rather than hardware related.
Please pastebin the kernel configs from both systems.
Ideally from /proc/config.gz. If do don have that proc entry, please check that the config you are posting belongs to the running kernel.

The entire dmesg from the dud may be interesting too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sun Jun 04, 2023 9:56 am    Post subject: Reply with quote

I'm with Neddy, I'm beginning to think something is not set right on the machine that doesn't work.

It does use the scsi interface, and usb storage does need BLK_DEV_SD set,
the help for USB_STORAGE mentions this but doesn't enforce it.

From my config
Code:
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_BSG=y
CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_DEV_FD=m
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_BLK_DEV_NVME=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
...
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_MOD=y
CONFIG_SCSI_SCAN_ASYNC=y
CONFIG_SCSI_SPI_ATTRS=m

_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 11:38 am    Post subject: Reply with quote

Quote:
Please pastebin the kernel configs from both systems.

I don't do pastebin, please don't advice me to use shady services. The config.gz's taken from /proc are here:
Good: https://code.pa4wdh.nl.eu.org/log/pc12.config.gz
Bad: https://code.pa4wdh.nl.eu.org/log/pc18.config.gz
Full dmesg from bad: https://code.pa4wdh.nl.eu.org/log/pc18.dmesg
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 12:50 pm    Post subject: Reply with quote

I've been monitoring my USB bus with wireshark to see what's happening, and it seems my USB-Sata bridge is responding different.
On a good system (a different system than the config.gz is from):
Code:
Frame 88: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface usbmon1, id 0
USB URB
USB Mass Storage
SCSI Payload (Read Capacity(10) Response Data)
    [LUN: 0x0000]
    [Command Set:Direct Access Device (0x00) ]
    [SBC Opcode: Read Capacity(10) (0x25)]
    [Request in: 85]
    [Response in: 90]
    LBA: 4294967295 (2047 GB)
    Block size in bytes: 512


On the bad system:
Code:
Frame 147: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface usbmon0, id 0
USB URB
USB Mass Storage
SCSI Payload (Read Capacity(10) Response Data)
    [LUN: 0x0000]
    [Command Set:Direct Access Device (0x00) ]
    [SBC Opcode: Read Capacity(10) (0x25)]
    [Request in: 144]
    [Response in: 149]
    LBA: 2147484930 (1024 GB)
    Block size in bytes: 512

Note the difference in reported capacity. Keep in mind this is the READ_CAPACITY(10) response, so it's expected to report the wrong capacity. However, on the good system 4294967295 sectors is 0xffffffff, which is the value checked in drivers/scsi/sd.c line 2443 and triggers the use of READ_CAPACITY(16) as reported in the working dmesg. Of course this doesn't tell why it's responding different, but it explains the difference in response from the kernel when the drive is detected.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 2:57 pm    Post subject: Reply with quote

As an experiment i've addad my USB-Sata bridge to the unusual devs file (drivers/usb/storage/unusual_devs.h) with this entry:
Code:

UNUSUAL_DEV(  0x152d, 0x2509, 0x0100, 0x0100,
      "JMicron",
      "SHARKOON COMBO",
      USB_SC_DEVICE, USB_PR_DEVICE, NULL,
      US_FL_NEEDS_CAP16),

After a recompile/reboot dmesg tells the good news:
Code:
[   77.646154] usb 2-1: new SuperSpeed USB device number 2 using xhci_hcd
[   77.677868] usb 2-1: New USB device found, idVendor=152d, idProduct=2509, bcdDevice= 1.00
[   77.677888] usb 2-1: New USB device strings: Mfr=1, Product=11, SerialNumber=3
[   77.677898] usb 2-1: Product: SHARKOON COMBO
[   77.677905] usb 2-1: Manufacturer: JMicron
[   77.677911] usb 2-1: SerialNumber: 00A1234567D0
[   77.680203] usb-storage 2-1:1.0: USB Mass Storage device detected
[   77.680758] usb-storage 2-1:1.0: Quirks match for vid 152d pid 2509: 400000
[   77.680936] scsi host2: usb-storage 2-1:1.0
[   78.746775] scsi 2:0:0:0: Direct-Access     SHARKOON COMBO            0000 PQ: 0 ANSI: 5
[   78.747349] sd 2:0:0:0: Attached scsi generic sg1 type 0
[   78.747967] sd 2:0:0:0: [sdb] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[   78.748484] sd 2:0:0:0: [sdb] Write Protect is off
[   78.748499] sd 2:0:0:0: [sdb] Mode Sense: 28 00 00 00
[   78.749199] sd 2:0:0:0: [sdb] No Caching mode page found
[   78.749213] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[   79.072687]  sdb: sdb1
[   79.073189] sd 2:0:0:0: [sdb] Attached SCSI disk

The drive works as expected and can be mounted/used.

Now i'm a bit unsure it this is the right solution, but at least it's a workaround for now.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sun Jun 04, 2023 3:32 pm    Post subject: Reply with quote

IMO, that is one of the right ways to fix the problem, I've had to add to quirks files before.
Files like that are there for a reason.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sun Jun 04, 2023 4:03 pm    Post subject: Reply with quote

pa4wdh,

Is that already in the kernel on the working system?

That's one of the better ways to fix it. Its device specific that way.
Is it worth a Gentoo bug.?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 5:11 pm    Post subject: Reply with quote

Quote:
Is that already in the kernel on the working system?

I've made the change on the not-working system, all other systems are left as they were.

Quote:
Is it worth a Gentoo bug.?

Would be nice if it could be part of the genpatches or upstreamed via the gentoo kernel project. There's not really a nice way to submit changes like this as an end user.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Sun Jun 04, 2023 5:36 pm    Post subject: Reply with quote

pa4wdh,

Start with a gentoo bug then.
Let the kernel devs decide if it should bu pushed upstream or not.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5353
Location: Bavaria

PostPosted: Sun Jun 04, 2023 6:25 pm    Post subject: Reply with quote

pa4wdh,

I have compared both kernel config-files and there are two main differences which could have an impact. On your bad machine you have:
Code:
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y

# CONFIG_INTEL_IOMMU is not set

(On your good machine you have OPTIMIZE_FOR_PERFORMANCE and INTEL_IOMMU is enabled; without this you will miss also other options like e.g. PCI_PRI ...)

Maybe try to change only one of them and see if it helps (to be honest: OPTIMIZE_FOR_SIZE is really bad and you should never use it for standard desktop/server machines)
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 04, 2023 6:48 pm    Post subject: Reply with quote

@pietinger:
Thanks for pointing those differences out.
I wasn't aware of OPTIMIZE_FOR_SIZE (i started off with the install iso, maybe it's worth checking the config there), so I'll change it to OPTIMIZE_FOR_PERFORMANCE. INTEL_IOMMU seems to make sense too (although i don't expect it'll solve this issue).

Edit: I've changed both options, it doesn't make a difference for this problem. I'll keep them this way anyway because i think it makes sense :)

@NeddySeagoon:
I'll file the bug after i checked pietinger's suggestions.
In the mean time i made a user patch to easily apply the same change to future versions if needed:
Code:
--- linux-6.1.19-gentoo/drivers/usb/storage/unusual_devs.h   2022-12-11 23:15:18.000000000 +0100
+++ linux-6.1.19-gentoo-mod/drivers/usb/storage/unusual_devs.h   2023-06-04 20:24:09.374711468 +0200
@@ -2425,6 +2425,12 @@
       "Digital MP3 Audio Player",
       USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
 
+UNUSUAL_DEV(  0x152d, 0x2509, 0x0100, 0x0100,
+      "JMicron",
+      "SHARKOON COMBO",
+      USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+      US_FL_NEEDS_CAP16),
+
 /* Unusual uas devices */
 #if IS_ENABLED(CONFIG_USB_UAS)
 #include "unusual_uas.h"

_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Mon Jun 05, 2023 5:13 pm    Post subject: Reply with quote

I'm still in doubt if this is the right way to go.

The thing is: The same hardware with the same software, even with my limited number of systems, works in 87.5% of the situations, the patch is only to make the other 12.5% work. It feels bad to blame the USB-Sata bridge, there must be something else misbehaving, although I don't know what.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54798
Location: 56N 3W

PostPosted: Mon Jun 05, 2023 5:17 pm    Post subject: Reply with quote

pa4wdh,

Does same == identical?
Especially kernel versions and configuration?

I don't think its hardware either.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Mon Jun 05, 2023 5:46 pm    Post subject: Reply with quote

NeddySeagoon wrote:
pa4wdh,

Does same == identical?
Especially kernel versions and configuration?

I don't think its hardware either.

Of course configurations differ because different hardware needs a different configuration, but there are no relevant differences are far as i can see. Kernels are 6.1.12 (working) and 6.1.19 (not working), but there have been no changes in drivers/scsi/sd.c.
To be 100% i can upgrade the 6.1.12 kernel to 6.1.19.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum