I know about the advanced format and setting 2048 free sectors at the beginning of a disk. But I just converted a partition table of my disk from MS-DOS to GPT, and I noticed this:
Before:
Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 31,5GB 31,5GB primary ntfs
2 31,5GB 43,0GB 11,5GB primary
3 43,0GB 44,1GB 1074MB primary linux-swap(v1)
4 44,1GB 80,0GB 36,0GB extended
5 44,1GB 54,6GB 10,5GB logical
6 54,6GB 65,0GB 10,5GB logical ext4 boot
7 65,0GB 80,0GB 15,0GB logical
80,0GB 80,0GB 56,8kB Free Space
After:
Number Start End Size File system Name Flags
17,4kB 1049kB 1031kB Free Space
1 1049kB 31,5GB 31,5GB ntfs Microsoft basic data msftdata
2 31,5GB 43,0GB 11,5GB Linux filesystem
3 43,0GB 44,1GB 1074MB linux-swap(v1) Linux swap
44,1GB 44,1GB 1049kB Free Space
5 44,1GB 54,6GB 10,5GB Linux filesystem
54,6GB 54,6GB 1049kB Free Space
6 54,6GB 65,0GB 10,5GB ext4 Linux filesystem
65,0GB 65,0GB 1049kB Free Space
7 65,0GB 80,0GB 15,0GB Linux filesystem
80,0GB 80,0GB 39,9kB Free Space
As you can see, there's 3 additional gaps there (2048 sectors), each for one extended partition. There's no gaps between 1st and 2nd, and 2nd and 3rd partition.
Does anyone know why the gaps exist only between logical partitions?
Best Answer
Partitioners like to align partitions on a mebibyte boundary these days. For MBR partitioning, there are 4 primary partitions, and for the rest you need extended and logical partitions.
While the layout of the primary partitions is expressed at the end of the first sector of the disk, for the logical partitions, you've got a linked list of additional partition tables (themselves specifying only one partitition. Typically, the first one is as the beginning of the extended partition (which is itself defined as a primary partition) and defines the first logical partition, and it links to the next partition table which defines the next logical partition. That next partition table will be located typically after the first logical partition.
All those partition tables only take a few bytes outside of the partitions, but because of the mebibyte alignment, a full mebibyte has to be used for them.
GPT on the other end stores all the partitioning information at the beginning of the disk (with a backup at the end), so after converting, that space that was used for the logical partition partition tables becomes free.
Note that you only need one sector to store those MBR logical partition tables, so strictly speaking, in MBR partitioning there would be 2047 sectors free, if the partionner was willing not to align partitions on mebibyte boundaries.