Unable to create logical partition with Parted

16,657

The extended and logical partitions make sense only with msdos partition table. It's only purpose is to allow you to have more than 4 partitions. With GPT, there are only 'primary' partitions and their number is usually limited to 128 (however, in theory there is no upper limit implied by the disklabel format). Note that on GPT none of the partitions could overlap (compare to msdos where extended partition is expected to overlap with all contained logical partitions, obviously).

Next thing about GPT is that partitions could have names, and here comes the confusion: the mkpart command has different semantics depending on whether you use GPT or msdos partition table.

With msdos partition table, the second argument to mkpart is partition type (primary/logical/extended), whereas with GPT, the second argument is the partition name. In your case it is 'primary' resp. 'extended' resp. 'logical'. So parted created two GPT partitions, first named 'primary' and second with name 'extended'. The third partition which you tried to create (the 'logical' one) would overlap with the 'extended', so parted refuses to do it.

In short, extended and logical partitions do not make sense on GPT. Just create as many 'normal' partitions as you like and give them proper names.

Share:
16,657

Related videos on Youtube

Vatsal Mehta
Author by

Vatsal Mehta

Updated on September 18, 2022

Comments

  • Vatsal Mehta
    Vatsal Mehta over 1 year

    I was fiddling around with parted command on a loopback disk and tried to create some partitions using gpt part table but I keep getting Error: Unable to satisfy all constraints on the partition. when trying to create a logical partition

    $ sudo parted /dev/loop0
    (parted) mktable gpt
    (parted) mkpart primary 1MiB 201MiB
    (parted) mkpart extended 201MiB -0MiB
    (parted) unit MiB print
    Model: Loopback device (loop)
    Disk /dev/loop0: 102400MiB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number  Start    End        Size       File system  Name      Flags
     1      1.00MiB  201MiB     200MiB                  primary
     2      201MiB   102400MiB  102199MiB               extended
    
    (parted) mkpart logical 202MiB 1024MiB
    Error: Unable to satisfy all constraints on the partition.
    

    Recreating the same partitions using msdos part table doesn't give such error, though. So any idea what's wrong?

    % sudo parted /dev/loop0
    GNU Parted 2.3
    Using /dev/loop0
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) mktable msdos                                                    
    (parted) mkpart primary 1MiB 201MiB
    (parted) mkpart extended 201MiB -0MiB                                   
    (parted) mkpart logical 202MiB 1024MiB                                 
    (parted) unit MiB print                                                   
    Model: Loopback device (loop)
    Disk /dev/loop0: 102400MiB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start    End        Size       Type      File system  Flags
     1      1.00MiB  201MiB     200MiB     primary
     2      201MiB   102400MiB  102199MiB  extended               lba
     5      202MiB   1024MiB    822MiB     logical
    
  • Vatsal Mehta
    Vatsal Mehta over 11 years
    Oh..that explains a lot why I kept getting the error. I was under impression that I could have logical partitions because I was able to "create" extended partition successfully. Thanks for the explanation!