[parted-devel] 4K sector and alignment support?

Jim Meyering jim at meyering.net
Fri Dec 7 22:05:52 UTC 2007


Jeff Garzik <jeff at garzik.org> wrote:
> Greetings from your friendly neighborhood SATA kernel hacker!

Hi Jeff,

> Drive companies like Seagate and Western Digital are beginning to poke
> me about 1K and 4K sector support.
>
> Specifically, they are referring to drives that will have a 1K or 4K
> _physical_ sector size, yet still present the same old 512-byte sector
> size to the ATA driver and OS.
>
> The main need is 1K and 4K sector _alignment_ support.  Does parted
> already have this?
>
> Future ATA drives can be odd-aligned or even-aligned.
>
> Even-aligned 1K drives writing 1K of data at sector #100 will (in "disk
> pseudocode") do:
>
> 	* seek to LBA 100
> 	* write data to LBA 100-101
>
> Odd-aligned 1K drives writing 1K of data at sector #100 will do:
>
> 	* seek to LBA 99
> 	* read LBA 99-102
> 	* update data from internal buffer
> 	* write data to LBA 99-102
>
> The latter is called a "read-modify-write cycle," and its a performance
> killer.

Ouch.  I can believe that.

> Therefore, it is critical that partition alignment matches internal ATA
> disk sector alignment, when these 1K and 4K drives come out.

There's a lot of alignment-related infrastructure in parted.
See e.g., uses of ped_alignment_init in libparted/labels/*.c
or just "git-grep align".

Maybe all parted needs is a way to determine what alignment is required
on these new disks.  When are they expected to hit the market?

BTW, I spent some time making parted work with sector sizes > 512 a few
months ago.  Simulating larger sector sizes invariably provoked stack
overruns and other nastiness.  It's a pretty big mess.  I fixed a few,
and have some unfinished patches: other projects took priority.  Does
anyone care about larger-than-512-byte sector sizes?



More information about the parted-devel mailing list