[parted-devel] Optimal Partition Alignment

Anthony Wright anthony at overnetdata.com
Thu Sep 13 20:58:51 UTC 2012


I'm trying to write a piece of code that automatically partitions and
formats a wide range of disks. I've recently switched from fdisk and an
MBR partition table to a parted with a GPT partition table due to the
2TB partition size limit of the MBR partition table.

When I create partitions with mkpart I keep getting the message "The
resulting partition is not properly aligned for best performance."

The disk I'm practising on has a logical and physical sector size of 512
Bytes, and I'm aware that the first 34 sectors are occupied by the GPT.
If I create a partition from 34s - 9999s I get the warning. If I create
a partition from 2048s - 9999s I don't get the warning, but I do get the
warning for 2047s - 9999s & 1024s - 9999s.

It seems that I get the warning if the start of the partition isn't on a
sector where (S % 2048) != 0. This seems a little strange to me given
that the physical and logical sector sizes are the same. I would have
thought that on a disk with this geometry I could have any start sector
without affecting performance.

Could somebody explain what optimal partition alignment is, and how it
is calculated? My best guess at the is that the partition has to start
on a sector where (S % 2048) == 0, but I don't understand why, and so I
don't know if it only works for my test environment.

Thanks,

Anthony



More information about the parted-devel mailing list