Linked by theosib on Sun 14th Feb 2010 10:45 UTC

Recently, I bought a pair of those new Western Digital Caviar Green drives. These new drives represent a transitional point from 512-byte sectors to 4096-byte sectors. A number of articles have been published recently about this, explaining the benefits and some of the challenges that we'll be facing during this transition. Reportedly, Linux should unaffected by some of the pitfalls of this transition, but my own experimentation has shown that Linux is just as vulnerable to the potential performance impact as Windows XP. Despite this issue being known about for a long time, basic Linux tools for partitioning and formatting drives have not caught up.

Thread beginning with comment 409346
To read all comments associated with this story, please click here.
GNU Parted
by lemur2 on Mon 15th Feb 2010 02:19 UTC
Member since:

I have two drives, /dev/sdc and /dev/sdd, both identical Green drives. I partitioned them as follows:

For /dev/sdd, I used fdisk to add a Linux (0x83) primary partition, taking up the whole disk, using fdisk defaults. By default, the partition starts at LBA 63.

For /dev/sdc, I used fdisk the same as with sdd, but after creating the partition, I realigned it. I did this by entering expert mode ("x"), then setting the start sector ("b") to 64.

Does GNU Parted support physical sector sizes not equal to 512?
Starting from 1.7, GNU Parted will automatically align partitions to the physical sector size reported by an ATAPI-compliant drive.

Surely you should be using parted to partition drives, and not fdisk?

Reply Score: 2

RE: GNU Parted
by theosib on Mon 15th Feb 2010 04:27 in reply to "GNU Parted"
theosib Member since:

This drive does not in any way report its physical sector size. It says its sectors are 512 and that's it.

Reply Parent Score: 2

RE[2]: GNU Parted
by darknexus on Mon 15th Feb 2010 08:18 in reply to "RE: GNU Parted"
darknexus Member since:

Shouldn't WD correct that then? How is a disk tool supposed to partition a drive properly if the drive itself is reporting incorrect data? If the physical sectors are 4096, the drive should report 4096 shouldn't it?

Reply Parent Score: 2

RE[2]: GNU Parted
by mkpetersen on Mon 15th Feb 2010 14:01 in reply to "RE: GNU Parted"
mkpetersen Member since:

First of all it's important to distinguish between logical block size which is used when sending commands to a device and the physical block size which is used by the device internally.

Linux has supported (SCSI) drives that present 4KB logical block sizes for a long time. For compatiblity with legacy OS'es, however, consumer grade ATA drives with 4KB physical blocks continue to present a 512-byte logical block interface. The knob indicating that the drive has 4KB physical blocks is orthogonal to the logical block size reporting, allowing the information to be communicated without interfering with legacy OS'es like XP that only know about 512-byte sectors.

We have worked closely with disk manufacturers for a long time to make sure we were ready. Western Digital have been instrumental in the ATA specification in terms of the alignment and physical block size parameters. The engineering sample drives I have received from WDC have all implemented the physical block size knobs correctly. Which makes it even more baffling that they end up shipping an advanced format drive that gets it wrong. I have no idea why they did that. The location of the block size information in IDENTIFY DEVICE is unlikely to be inspected by legacy systems, so I highly doubt it's a compatibility thing. Brown paper bag time for Western Digital...

It is true that the effects of this particular drive reporting incorrect information could have been mitigated by a 1MB default alignment. However, that would still have caused misalignment for other drives that come wired with 1-alignment to compensate for the legacy DOS sector 63 offset. So blindly aligning to 1MB won't cut it. Windows Vista/7 don't do that either. Like Linux, they compensate based upon what the drive reports.

Linux 2.6.31 and beyond will report device alignment and physical block size for all block devices. It is then up to the userland partitioning utilities etc. to adjust start offsets accordingly. You'll find that both parted and util-linux-ng have been updated to do this. And that modern fdisk will in fact align on a 1MB (+/- drive alignment) boundary by default.

Caveat being that Fedora is the only community distribution I know of that's using the updated bits. I don't think all of them made it into Fedora 12 but I'm sure Fedora 13 will do the right thing.

So I encourage you to work with your distribution vendor to ensure they start shipping recent partition tooling.

Martin K. Petersen
Kernel Developer, Oracle Linux Engineering

Reply Parent Score: 5