Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 329749 - sys-apps/sg3_utils-1.29: we need updates for the upcoming Advanced formatted drives with 4kB sectors
Summary: sys-apps/sg3_utils-1.29: we need updates for the upcoming Advanced formatted ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-24 20:50 UTC by Martin Mokrejš
Modified: 2010-08-24 19:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2010-07-24 20:50:54 UTC
I am on ~x86 system and have outdated tools. The sda drive is a classical drive with 512 kB sector size whereas the sdb disc is a 2.5" WD10TPVT disc which is formatted using 4kB sectors from the manufacturer (outdated "sg_readcap" fails on it). 

# sg_readcap -l /dev/sda
Read Capacity results:
   Protection: prot_en=0, p_type=0, p_i_exponent=0
   Thin provisioning: tpe=0, tprz=0
   Last logical block address=625142447 (0x2542eaaf), Number of logical blocks=625142448
   Logical block length=512 bytes
   Logical blocks per physical block exponent=0
   Lowest aligned logical block address=0
Hence:
   Device size: 320072933376 bytes, 305245.3 MiB, 320.07 GB
# sg_readcap -l /dev/sdb
READ CAPACITY (16) not supported
# sg_readcap -l /dev/sdb -vvv
open /dev/sdb with flags=0x802
    read capacity (16) cdb: 9e 10 00 00 00 00 00 00 00 00 00 00 00 20 00 00 
      duration=2 ms
read capacity (16):  Fixed format, current;  Sense key: Illegal Request
 Additional sense: Invalid command operation code
 Raw sense data (in hex):
        70 00 05 00 00 00 00 0a  00 00 00 00 20 00 00 00    
        00 00                                               
    requested 32 bytes but got 0 bytes
READ CAPACITY (16) not supported
# sg_readcap -V
Version string: 3.84 20090422
#

This is discussed here:
http://markmail.org/message/dsccia7fz6uo3gnj


I am running 2.6.34.1 kernel, symlinked to it /usr/src/linux and recompiled util-linux, parted, sg3_utils. I don't understand why I still get "READ CAPACITY (16) not supported". Is that because it is an external drive connected via USB to SATA(+IDE) device from JMicron?

usb 5-1: new high speed USB device using ehci_hcd and address 3
usb 5-1: New USB device found, idVendor=152d, idProduct=2338
usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5
usb 5-1: Product: USB to ATA/ATAPI Bridge
usb 5-1: Manufacturer: JMicron
usb 5-1: SerialNumber: D57851C10581
scsi4 : usb-storage 5-1:1.0
scsi 4:0:0:0: Direct-Access     WDC WD10 TPVT-00HT5T0     1A01 PQ: 0 ANSI: 2 CCS
sd 4:0:0:0: Attached scsi generic sg2 type 0
sd 4:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
sd 4:0:0:0: [sdb] Write Protect is off
sd 4:0:0:0: [sdb] Mode Sense: 00 38 00 00
sd 4:0:0:0: [sdb] Assuming drive cache: write through
sd 4:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1
sd 4:0:0:0: [sdb] Assuming drive cache: write through
sd 4:0:0:0: [sdb] Attached SCSI disk



# cat /sys/dev/block/*/queue/minimum_io_size 
512
512
512
512
512
512
512
512
512
512
512
512
512
512
512
512
512
512
0
0
0
0
0
0
0
0
512
512
#
Comment 2 SpanKY gentoo-dev 2010-07-26 03:09:37 UTC
where is the upstream fix ?  if the relevant upstream lists dont have a fix, we're not going to come up with one here.
Comment 3 Martin Mokrejš 2010-08-24 19:14:27 UTC
I found the disk does not announce it is 4kb formatted. So, there is no problem with Gentoo except the fact that util-linux-ng is named sys-apps/util-linux while the SRC_URI links to the *-ng sources. But this bug report is not about that.

http://inkhornnet.wordpress.com/2010/04/03/westerndigital-wd10tpvt-advanced-format


And from communication with Tejun Heo, linux kernel developer I can quote:

<quote>
On 08/21/2010 01:44 AM, Martin Mokrejs wrote:
> > Hi Tejun,
> > I read a number of docs on the net and it seems I bought WD Scorpio Blue 1TB
> > drive which does not report 4kb physical size. I am on Gentoo Linux with
> > all updated packages (~x86 testing). Routinely I use 2.6.31.14 kernel but I
> > tried even 2.6.34 with no difference. The disk is connected via USB JM20337
> > chip (is crappy for the PATA but SATA should be fine).

That's normal.  Some BIOSes puke when they see 4KiB logical sector
size so drives lie about logical sector size.  :-(

> > # fdisk -l -u /dev/sdb
> > 
> > Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
> > 81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 sectors
> > Units = sectors of 1 * 512 = 512 bytes
> > Sector size (logical/physical): 512 bytes / 512 bytes
> > I/O size (minimum/optimal): 512 bytes / 512 bytes
> > Disk identifier: 0x96df8562
> > 
> >    Device Boot      Start         End      Blocks   Id  System
> > /dev/sdb1            2048  1953525167   976761560   83  Linux

Your partition size is properly aligned.  As long as it's properly
aligned, everything is fine.

Thanks.

-- tejun
</quote>