Skip to contentSkip to conversation

4k sector size and WD20EARS

DISCUSSION Alexander Clausen 4 participants 9 messages Apr 8, 2010 – Apr 12, 2010 libata

lore
Share & tools
lore
#0 lore raw

Hi,
i just bought some WD20EARS harddisk. They are supposed to have 4k physical sector size, right? My system seems to think they are not:

alex@hal:/sys/block/sdb/queue$ cat logical_block_size physical_block_size
512
512
alex@hal:/sys/block/sdb/queue$
alex@hal:~$ uname -a
Linux hal 2.6.33.2 #1 SMP PREEMPT Sun Apr 4 20:52:14 CEST 2010 x86_64 GNU/Linux
alex@hal:~$

from dmesg:

scsi 1:0:0:0: Direct-Access ATA WDC WD20EARS-00S 80.0 PQ: 0 ANSI: 5
sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

so, who is right?

The current partition table looks like:

alex@hal:~$ sudo cfdisk -P s /dev/sdb
Partition Table for /dev/sdb

First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
1 Primary 0 3907024064 63 3907024065 Linux (83) None
alex@hal:~$

is that okay for 4k sector size?

Alexander

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alexander" == Alexander Clausen <[email protected]> writes:

Alexander> Hi, i just bought some WD20EARS harddisk. They are supposed Alexander> to have 4k physical sector size, right? My system seems to Alexander> think they are not:

Alexander> alex@hal:/sys/block/sdb/queue$ cat logical_block_size Alexander> physical_block_size 512 512

Alexander> so, who is right?

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

There really isn't much we can do about devices that don't tell us the truth. However, recent fdisk/parted will align on a 1MB boundary by default which happens do the trick in this particular case (because the WDC drive is naturally aligned).

Alexander> 1 Primary 0 3907024064 63 3907024065 Linux (83) None Alexander> alex@hal:~$

Alexander> is that okay for 4k sector size?

No, you should shift the start sector using the fdisk's advanced menu.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
Quoted 2 lines · Martin K. Petersen

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

It's not unknown, it's for compatibility reasons.

The original poster is well off reading the earlier discussions on linux-raid regarding these drives.

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
#3 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mikael" == Mikael Abrahamsson <[email protected]> writes:

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

Mikael> It's not unknown, it's for compatibility reasons.

We still haven't been given a comprehensive explanation. "It breaks something for someone" doesn't really give us much to work with...

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
Quoted 1 line · Martin K. Petersen

We still haven't been given a comprehensive explanation. "It breaks something for someone" doesn't really give us much to work with...

I'd imagine the market for a 4k sector drive which only does 4k sectors on the wire, would be very limited considering the amount of driver and OS support for this. Otoh a lot of OSes write 8 blocks at the same time because they use 4k page sizes so doing 512b sectors on the SATA layer and 4k when writing to the drive makes a lot of sense.

I don't really see what it is you're looking for when it comes to "more information"?

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
#6 lore raw
In reply to Martin K. Petersen
Quoted 2 lines · Martin K. Petersen

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

ouch.

Quoted 7 lines

However, recent fdisk/parted will align on a 1MB boundary by default which happens do the trick in this particular case

Alexander> 1 Primary 0 3907024064 63 3907024065 Linux (83) None
Alexander> alex@hal:~$

No, you should shift the start sector using the fdisk's advanced menu.

I created this partition table using cfdisk (util-linux 2.17 from debian/experimental). I guess even that is too old?

I now re-created the partition table using fdisk from util-linux-ng git and got this:

Command (m for help): p

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 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: 0x2afff6d1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3907029167  1953513560   83  Linux

but:

$ sudo cfdisk -P s /dev/sdb
FATAL ERROR: Bad primary partition 0: Partition ends in the final partial cylinder

bug?

thanks for the help,
Alexander

#5 lore raw
In reply to Mikael Abrahamsson
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mikael" == Mikael Abrahamsson <[email protected]> writes:

We still haven't been given a comprehensive explanation. "It breaks something for someone" doesn't really give us much to work with...

Mikael> I don't really see what it is you're looking for when it comes Mikael> to "more information"?

The physical block size is reported in IDENTIFY DEVICE word 106 which hasn't been and isn't used for anything else. So nothing should be looking there unless it is 4KB sector-aware.

I've been testing a variety of drives with 4KB sectors for well over a year. All of them correctly reporting the physical block size. The only real problems I have found during testing have been missing SCSI-ATA translation or incorrect alignment reporting (SCSI and ATA express things differently).

It's bad enough that our I/O stack has to deal with hordes of USB ATA bridge devices that are unintentionally broken. But now we are talking production disk drives that were intentionally neutered. And we're not being told why.

Obviously some of this might fall into NDA territory. And that's fair enough. My gripe is that nothing has been done to substantiate the issue. A problem that apparently warranted blowing away years of industry-wide standardization, implementation, and testing efforts. That's no small thing in my book.

I also want to be assured that the real root cause gets fixed. We obviously want future drives to be both standards-compliant and accurate in their reporting.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#7 lore raw
In reply to Alexander Clausen
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alexander" == Alexander Clausen <[email protected]> writes:

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

Alexander> ouch.

Yeah, I know...

Alexander> $ sudo cfdisk -P s /dev/sdb FATAL ERROR: Bad primary Alexander> partition 0: Partition ends in the final partial cylinder

Alexander> bug?

I'm not sure cfdisk has been kept in sync with the alignment and block size changes. Karel?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#8 lore raw
Quoted 10 lines · Martin K. Petersen
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alexander" == Alexander Clausen <[email protected]> writes:

For unknown reasons these drive report themselves as 512-byte drives despite using 4096-byte sectors internally.

Alexander> ouch.

Yeah, I know...

Quoted 7 lines

Alexander> $ sudo cfdisk -P s /dev/sdb FATAL ERROR: Bad primary Alexander> partition 0: Partition ends in the final partial cylinder

Alexander> bug?

I'm not sure cfdisk has been kept in sync with the alignment and block size changes. Karel?

Unfortunately, sfdisk and cfdisk have no clue about alignment and disks topology.

Now only the fdisk and parted commands are ready for new disks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com