Bug 2225137

Summary: Disk attached via usb/sata adaptor shows reduced capacity
Product: [Fedora] Fedora Reporter: Maximilian Reininghaus <max.reininghaus>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: acaringi, adscvr, airlied, alciregi, bskeggs, hdegoede, hpa, jarodwilson, josef, kernel-maint, lgoncalv, linville, masami256, mchehab, ptalbert, steved
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Maximilian Reininghaus 2023-07-24 11:29:09 UTC
I have a 4TB SATA harddrive attached as external drive in a USB (2.0) casing that features a SATALink SPIF225A adaptor IC. It shows up (e.g. in gparted) as having only 2 TB (1.64 TiB). When attaching the drive directly via SATA on another Linux system, the correct size is reported.

I am not really sure where the root of problem lies. Perhaps the IC doesn't support big HDDs at all (the casing is >10 yr old after all), perhaps it's a driver/kernel module issue.

Note that this does not seem to be a problem of MBR vs. GPT partition tables.

Reproducible: Always

Steps to Reproduce:
1. put 4TB HDD into USB casing
2. attach via USB
3. check disk size
Actual Results:  
disk size reported as 2 TB (1.64 TiB)

Expected Results:  
disk size reported as 4 TB

# uname -a                                                                                                                                                                                                
Linux dyn-dhcp-141-52-66-132.iap.kit.edu 6.3.12-100.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul  5 20:09:58 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

# smartctl -x /dev/sdb
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.3.12-100.fc37.x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate BarraCuda 3.5 (SMR)
Device Model:     ST4000DM004-2CV104
Serial Number:    WFN8AV46
LU WWN Device Id: 5 000c50 0f1e0d3e4
Firmware Version: 0001
User Capacity:    4.000.787.030.016 bytes [4,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5425 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Mon Jul 24 12:19:04 2023 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Enabled
Write cache is:   Enabled
DSN feature is:   Unavailable
ATA Security is:  Disabled, NOT FROZEN [SEC1]
Wt Cache Reorder: Unavailable


# lsblk -o "NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID"
[...]
sdb                                             8:16   0   1,6T  0                        
[...]


# hdparm -I /dev/sdb                                                                                                                                                                                      :(

/dev/sdb:

ATA device, with non-removable media
	Serial Number:      �@
Standards:
	Likely used: 1
Configuration:
	soft sectored
	head switch time > 15us
	fixed drive
	disk xfer rate <= 5Mbs
	disk xfer rate > 5Mbs, <= 10Mbs
	data strobe offset option
	format speed tolerance gap reqd
	Logical		max	current
	cylinders	17218	0
	heads		0	0
	sectors/track	128	0
	--
	bytes/track: 512	bytes/sector: 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 

# lsusb
[...]
Bus 001 Device 003: ID 04fc:0c25 Sunplus Technology Co., Ltd SATALink SPIF225A
[...]

Comment 1 Hans de Goede 2023-08-14 08:09:04 UTC
This sounds like your USB SATA enclosure is not capable of handling disks > 2TB .

Esp. this part is interesting (if correct):

SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 1.5 Gb/s)

1.5 Gb/s is SATA 1 so that is a really old enclosure (or it somehow does not like the disk), which likely is limited to 32 bit sector addresses instead of 48 bit sector addresses like newer enclosures.

32 bit sector addresses limit the addressable range to 2TB (512 * 4 * 10^9), so the enclosure is likely capping the reported size to the addressable range.