Why are there 2048 sectors of free space between each logical partition?
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.
Related videos on Youtube
VinoPravin
I'm a Debian user who wants to know all about the linux world. If there's a problem with some software or hardware under this operating system, I can fix it, of course I need some time to do that. I don't know many things, but sooner or later I always develop an OpenSource solution and make things work whether they like it or not.
Updated on September 18, 2022Comments
-
VinoPravin over 1 year
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?
-
Admin over 10 yearsHow exactly did you convert the disk "from MBR to GPT"? There is no MBR partition table type. Maybe you meant DOS, but still, how did you convert?
-
Admin over 10 yearsI just used gdisk.
-
Admin over 10 yearsHow do you convert using gdisk? This is important because you (or the program you use) might have done something wrong when converting.
-
Admin over 10 yearsI followed these steps -- wiki.archlinux.org/index.php/…
-
Admin over 10 yearsIt's 2048*512 in each case.
-
Admin over 10 yearsThe gaps don't hurt; and you have the option to convert back to msdos partitions. Sticking with GPT, you could grow each partition to use the 1MiB gap that follows it.
-
-
VinoPravin over 10 yearsI get it now, there's one EBR for each logical disk and "The second entry of an EBR partition table will contain zero-bytes if it's the last EBR in the extended partition; otherwise, it points to the next EBR in the EBR chain."