Project

General

Profile

8TB USB Mass Storage device being unreadable

Added by Dominik Marszk about 8 years ago

Hello!

I'm trying to use an USB device enumerating as a 8TB Mass Storage with 5CSX-H6-42A kit. It's connected through a mini-USB OTG adapter.
It doesn't appear to be working properly. Any read from the device ends up returning 0 bytes.
The device works on Raspberry PI, it was tested using kernel 4.4.26 and 3.12.36.

Please find attached relevant dmesg, dd and udevadm outputs for both RPI and Mity. The issue seems to be apparent zero size of block device, visible in udevadm output.

Please note that missing cdc_acm is not a problem. I resolved that by building a kernel with cdc_acm drivers built-in. That didn't change the incorrect storage device behavior.

I've also confirmed that our Mity setup works with an USB stick.

My ideas for further troubleshooting involve analysing verbose debug output from SCSI and Block device drivers, or trying to update to a newer Altera kernel mainline. Both are potentially very time consuming without a guarantee of resolving the problem though, so maybe you guys could suggest or help us with any other solutions.

rpi_udevadm.txt (8.17 KB) rpi_udevadm.txt RPI udevadm output
rpi_dmesg_and_dd.txt (1.4 KB) rpi_dmesg_and_dd.txt RPI dmesg and dd output
mity_udevadm.txt (5.59 KB) mity_udevadm.txt MitySOM udevadm output
mity_dmesg_and_dd.txt (1.19 KB) mity_dmesg_and_dd.txt MitySOM dmesg and dd output

Replies (8)

RE: 8TB USB Mass Storage device being unreadable - Added by Dominik Marszk about 8 years ago

The kernel used on MitySOM is 3.16.0.

RE: 8TB USB Mass Storage device being unreadable - Added by Daniel Vincelette about 8 years ago

Hello Dominik,

Have you tried a quick test of using a smaller flash drive with the MitySOM? Just to see if we can get a baseline, I've used 8GB/16GB flash drives on the MitySOM without issue.

Thanks!

Dan

RE: 8TB USB Mass Storage device being unreadable - Added by Dominik Marszk about 8 years ago

Hello Dan,

Yes. I tested with 8 and 16GB USB sticks as well and it works just fine, so the culprit might be in the unusual size.

RE: 8TB USB Mass Storage device being unreadable - Added by Daniel Vincelette about 8 years ago

So this might be a red herring but in the pi's dmesg it has the following line, which the MitySOM doesn't:

sd 0:0:0:0: Attached scsi generic sg0 type 0

It looks like it's using the SCSI generic driver, which isn't part of the MitySOM defconfig we maintain. Looks like the kconfig for it is: CONFIG_CHR_DEV_SG.

You might also might want to do a quick diff of the mitysom5csx_devkit_defconfig and the RPI's 3.16 defconfig to see if there might be some drivers for USB/SCSI that our defconfig doesn't have.

Dan

RE: 8TB USB Mass Storage device being unreadable - Added by Dominik Marszk about 8 years ago

Hey Dan,

Thanks for your reply.
Building CHR_DEV_SG into mitysom kernel doesn't seem to fix anything. The SG initialization message appears now though. I've also tried to use /dev/sg0 device as the dd input with and without DEV_SD driver included into kernel, without success.

I also find it odd that sd_read_capacity is being called twice (printing twice the total device size) but I cannot identify a reason of that.

[    2.434541] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[    2.438834] usb-storage 1-1:1.2: USB Mass Storage device detected
[    2.443855] scsi0 : usb-storage 1-1:1.2
[    3.445600] scsi 0:0:0:0: Direct-Access     ATMEL    Mass Storage MSD 0.01 PQ: 0 ANSI: 6
[    3.452968] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    3.453085] sd 0:0:0:0: [sda] 2147483648 4096-byte logical blocks: (8.79 TB/8.00 TiB)
[    3.468013] sd 0:0:0:0: [sda] Write Protect is off
[    3.471492] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
[    3.487538] sd 0:0:0:0: [sda] Asking for cache data failed
[    3.491704] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    3.497268] sd 0:0:0:0: [sda] 2147483648 4096-byte logical blocks: (8.79 TB/8.00 TiB)
[    3.536372] sd 0:0:0:0: [sda] Attached SCSI removable disk

Do you have any other ideas?

Kind regards,
Dominik

RE: 8TB USB Mass Storage device being unreadable - Added by Daniel Vincelette about 8 years ago

Hi Dominik,

The only thing I could really think of was try the very verbose USB output like you initially suggested or add printk's to the USB driver. Try it with a flash drive and then the 8TB devices and compare the outputs.

I'm sorry, if I can think of a better way to test this I'll be sure to let you know.

Dan

RE: 8TB USB Mass Storage device being unreadable - Added by Dominik Marszk about 8 years ago

Hey Dan!

I found the culprit! :)
As it often happens in linux kernel, the solution turns out to be very trivial.
It requires enabling CONFIG_LBDAF, which extends kernel partition device sector count width from 32 to 64 bits.
http://cateee.net/lkddb/web-lkddb/LBDAF.html

Kind regards,
Dominik

RE: 8TB USB Mass Storage device being unreadable - Added by Daniel Vincelette about 8 years ago

Hi Dominik,

Glad you found the solution! I know I've spent many hours working on kernel issues to have them solved with one line changes.

Thank you for the update!

Dan

    (1-8/8)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)