8

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?

  • How 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? – phunehehe Jan 4 '14 at 17:06
  • I just used gdisk. – Mikhail Morfikov Jan 4 '14 at 17:09
  • How do you convert using gdisk? This is important because you (or the program you use) might have done something wrong when converting. – phunehehe Jan 4 '14 at 17:13
  • 1
    I followed these steps -- wiki.archlinux.org/index.php/… – Mikhail Morfikov Jan 4 '14 at 17:15
  • It not possible to tell without seeing the partition table with units set to disk sectors (2,048 512-byte sectors are 1 MiB, less than the accuracy of the listed decimal numbers). MS-DOS partitions have weird emotional baggage that force alignment to various (now arbitrary) numbers, sometimes leaving unused sectors at the end. I have no clue why this is only the case for logical partitions here. – Alexios Jan 4 '14 at 17:30
8

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.

  • I 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." – Mikhail Morfikov Jan 5 '14 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.