Is GPT aligned for 4k blocks

alignmentgpthard drivepartitioning

The Wikipedia article for GUID Partition Table does not make it clear whether it is aligned to an underlying 4k-block filesystem. Seeing as the diagram shows the first block of the data sector as block 34, which is not divisible by 8 (512 bytes per sector * 8 sectors = a 4k block) then I am inclined to say no. Even if Windows makes the first partition a Microsoft Reserved Partition, as it apparently does usually, that partition is 65536 blocks (32 MiB), so still 65536+34=65570 which is not divisible by 8.

Am I missing something?

Best Answer

Yes, you're missing two things:

  • The EFI partition table is not required to be 34 blocks long. The Wikipedia article is downright misleading in this respect. Per the actual specification, rather than Wikipedia, the partition table length is determined by the size of the partition table entries and the number of partition table entries. They are both variable, and their values for any individial EFI partitioned disc are stored in the EFI partition table header. 34 blocks is merely what one gets with a 128 byte partition table entry size, a block size of 512 bytes, and a partition table with 128 entries. It's the minimum size of an EFI partition table, that the specification mandates. It's not the size.
  • The first usable block doesn't have to be the first used block. (It's not a "data section", by the way.) Just because on a particular disc block #34 may be the first usable block, it is not required that a partition start there. EFI partitioning tools can align partitions to whatever rules they like. (Indeed, several, such as Apple's Disk Utility, famously do. Rod Smith's gdisk has a non-trivial ruleset, too.) The EFI specification doesn't mandate that partitions be aligned to the first or last usable blocks. Indeed, it doesn't even, strictly speaking, mandate that the first usable block immediately follow the primary copy of the partition table.
Related Question