[CentOS] ext4, 4k sector alignment

Lamar Owen lowen at pari.edu
Tue Jul 26 12:57:22 UTC 2011


On Tuesday, July 26, 2011 05:21:58 AM John Doe wrote:
> From: John R Pierce <pierce at hogranch.com>
> > thats by "cylinder", which is an old MSDOS legacy thing.   I believe 
> > parted and probably some other programs let you partition by sector instead.
> In my kickstart pre script, I use:
> ... | sfdisk -H $HEADS -S $SECTORS -uS --force -L $DEVICE
> For SSDs, I saw the recommended respective values: 224 56 (or 32 32)
> fdisk also has -u for sectors unit, and -H/-S to force a fake geometry.

> But I must admit that I am still a bit confused with all these alignments...

The key thing is to be sector aligned per physical drive; align to eight sector blocks; a starting sector of 56 would work.  With RAID and LVM alignment to chunks or stripes is desireable.

Forget CHS specifications; they haven't been valid for years anyway; think LBA and only LBA and you'll be fine.  No drive made actually has 255 heads anyway.... or a constant 63 sectors per track, either, for that matter.  All mechanical hard drives made these days employ ZBR and have a variable number of sectors per track, less than ten (or 12, in the case of some 15K RPM FC and SCSI drives that I know about; have some 15KRPM 36GB SCSI drives with six physical platters, 12 genuine physical heads, all in a half-height 3.5 inch form-factor) heads, and many thousands of cylinders. 

SSDs don't even have heads or tracks, and thus those specifications are meaningless and need to just go away.  It's LBA all the way, and the critical alignment is to erase-block size.

See the following articles for more, and better, information that goes into a lot more detail than I have time to do:

http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/index.html?ca=dgr-lnxw074KB-Disksdth-LX

http://www.ocztechnologyforum.com/forum/showthread.php?48309-Partition-alignment-importance-under-Windows-XP-%2832-bit-and-64-bit%29..why-it-helps-with-stuttering-and-increases-drive-working-life.&p=335049#post335049

(yes, the thread says windows, but the particular post is about Linux)

http://www.tcpdump.com/kb/os/windows/disk-alignment/into.html (has some good illustrations that are relevant on Linux, even though the article is about Windows)

And there are more; those were all on the first page of a Google search for the terms 'sector alignment linux' (no quotes).



More information about the CentOS mailing list