ATA 4K sector issues

Dag-Erling Smørgrav des at des.no
Thu Mar 18 12:01:11 UTC 2010


Matthew Dillon <dillon at apollo.backplane.com> writes:
> We experimented a bit with aligning fdisk (dos slices) by changing the
> sector offset to 2 but I came to the conclusion that it was better to
> do the alignment in disklabel / gpt / whatever higher-level
> partitioner floats your boat and not mess with anything the BIOS uses
> to boot the machine

Not sure what you mean by "changing the sector offset to 2", but the
BIOS doesn't care where partitions start or end.  It just obeys the
partition table.

> My recommendation is to use a 1MB physical base alignment.  That's
> what I adjusted DragonFly's disklabel64 to do.  It's definitely best
> to have the partitioner deal with it instead of having to mess around
> manually because the partitioner can calculate the actual physical
> alignment by querying the kernel's disk subsystem regardless of the
> topology.

The disk system doesn't necessarily know.  Disks have been known to lie
about their physical sector size.  The best strategy is to consistently
use a large alignment "just in case".  Using a 4k or 8k or even 1M
alignment has no negative impact on 512b disks (other than that it
wastes a very small amount of disk space), but for a 4k disk or an SSD,
it can make the difference between "dog slow" and "lightning fast".

> * A variety of media already uses much larger physical block sizes.
>   MLC flash uses 128K and SLC uses 64K blocks.  See the note below
>   on why this matters even though SSDs do write combining.

Some SSDs do RAID0 internally and therefore have larger block sizes.
ISTR the OCZ Vertex is made up of four SATA SSDs with a microcontroller
in front.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-hackers mailing list