4

Under the MBR model, we could create four primary partitions one of which could an extended partition that's further subdivided into logical partitions.

Consider this GPT schematic taking from Wikipedia:

GPT

Partition entries range from LBA 1 to LBA 34, presumably we ran out of that space and I understand that's a fair amount of partitions, is it possible to make an extended partition if the disk partitioned with GPT? If possible how many extended partitions per GPT partition table we can make?

I'm not sure if this is a standard to have partition entries within the range LBA 1 to LBA 34, maybe we could expand partition entries beyond that?

Practically this is a fair amount of partitions, I have no intention to do that.

1

4 Answers 4

6

128 partitions is the default limit for GPT, and it's probably painful in practice to use half that many...

Linux itself originally also had some limitations in its device namespace. For /dev/sdX it assumes no more than 15 partitions (sda is 8,0, sdb is 8,16, etc.). If there are more partitions, they will be represented using 259,X aka Block Extended Major.

You could certainly still do more partitions in various ways. Loop devices, LVM, or even GPT inside GPT. Sometimes this happens naturally when handing partitions as block devices to virtual machines, they see the partition as virtual disk drive and partition that.

Just don't expect such partitions inside partitions to be picked up automatically.


As @fpmurphy1 pointed out in the comments, I was wrong: You can change the limit, using gdisk, expert menu, resize partition table. This can also be done for existing partition tables, provided there is unpartitioned space (a 512-byte sector for 4 additional partition entries) at the start and end of the drive. However I'm not sure how widely supported this is; there doesn't seem to be an option for it in parted or other partitioners I've tried.


And the highest limit you can set with gdisk seems to be 65536 but it's bugged:

Expert command (? for help): s Current partition table size is 128. Enter new size (4 up, default 128): 65536 Value out of range 

And then...

Expert command (? for help): s Current partition table size is 128. Enter new size (4 up, default 128): 65535 Adjusting GPT size from 65535 to 65536 to fill the sector Expert command (? for help): s Current partition table size is 65536. 

Eeeh? Whatever you say.

But try to save that partition table and gdisk is stuck in a loop for several minutes.

Expert command (? for help): w --- gdisk gets stuck here --- PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 22253 root 20 0 24004 11932 3680 R 100.0 0.1 1:03.47 gdisk --- unstuck several minutes later --- Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): Your option? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/loop0. Warning: The kernel is still using the old partition table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) The operation has completed successfully. 

And here's what parted has to say about the successfully completed operation:

# parted /dev/loop0 print free Backtrace has 8 calls on stack: 8: /usr/lib64/libparted.so.2(ped_assert+0x45) [0x7f7e780181f5] 7: /usr/lib64/libparted.so.2(+0x24d5e) [0x7f7e7802fd5e] 6: /usr/lib64/libparted.so.2(ped_disk_new+0x49) [0x7f7e7801d179] 5: parted() [0x40722e] 4: parted(non_interactive_mode+0x92) [0x40ccd2] 3: parted(main+0x1102) [0x405f52] 2: /lib64/libc.so.6(__libc_start_main+0xf1) [0x7f7e777ec1e1] 1: parted(_start+0x2a) [0x40610a] You found a bug in GNU Parted! Here's what you have to do: Don't panic! The bug has most likely not affected any of your data. Help us to fix this bug by doing the following: Check whether the bug has already been fixed by checking the last version of GNU Parted that you can find at: http://ftp.gnu.org/gnu/parted/ Please check this version prior to bug reporting. If this has not been fixed yet or if you don't know how to check, please visit the GNU Parted website: http://www.gnu.org/software/parted for further information. Your report should contain the version of this release (3.2) along with the error message below, the output of parted DEVICE unit co print unit s print and the following history of commands you entered. Also include any additional information about your setup you consider important. Assertion (gpt_disk_data->entry_count <= 8192) at gpt.c:793 in function _parse_header() failed. Aborted 

So parted refuses to work with GPT that has more than 8192 partition entries. Nobody ever does that, so it has to be corrupt, right?

This is what happens when you don't stick to defaults.

5
  • What would the device file names be after the 15th partition? /dev/sda16, /dev/sda17... with major/minor [259,0], [259, 1] respectively? Also, this makes me thinking what would the device file name be after sdz, sdaa for example? Commented Jul 30, 2017 at 12:37
  • 4
    @frostschutz. The current specification stipulates a MINIMUM of 16,384 bytes be reserved for the GPT partition table array - so there are 128 partition entries. There is nothing stopping you having more than 128 partitions if you increase the size of the partition table array. Commented Jul 30, 2017 at 15:55
  • @fpmurphy1 Is that supported anywhere? parted bails with Error: Too many primary partitions. (Frankly I'd be suprised if just 128 partitions didn't cause problems anywhere. Nobody expects that many partitions.) Commented Jul 30, 2017 at 17:49
  • Okay, gdisk has s resize partition table. Wow. Didn't know that. :) Thanks @fpmurphy1 Commented Jul 30, 2017 at 17:58
  • There is that magic number again 65536. Commented Oct 2, 2021 at 4:36
0

On GPT there are no extended partitions, as virtually it has no limit for number of partitions (the minimum supported is 128 partitions, which will use 16,384 bytes for the partition table, so if you reserve more space for it, you can have more partitions).

But then you'll face the limits of:

  • your operating system (ex: MS Windows is limited to 128)
  • tools used to handling partitions: gdisk, parted and several others have their limitations too (anyway a way higher than 128 partitions)
-1

As can be seen in the picture you included, GPT supports up to 128 partitions. There is no concept of extended partitions.

1
  • 1
    The current specification stipulates a MINIMUM of 16,384 bytes be reserved for the GPT partition table array - so there are 128 partition entries. There is nothing stopping you having more than 128 partitions if you increase the size of the partition table array. Commented Jul 31, 2017 at 9:52
-1

First thing you should remember, extended partition only available on an MBR disk. On GPT partition, all the partitions will be primary. GPT supports up to 128 partitions.

To create an extended partition with Disk Management, you must have some unallocated space. If you already have 3 primary partition, the 4th partition will be created as an extended partition.

One thing you should keep in mind: MBR only supports up to 4 primary partition. If you already have 4 primary partition, you can convert primary partition to extended partition without data loss.

2
  • GPT can have more than 128 partitions. On MBR, you do not have to create 3 primary partitions before you create an extended partition or leave some unallocated space at the end of the disk Commented Jul 31, 2017 at 9:50
  • On GPT there is no concept of a primary partition. There are just partitions. Commented Aug 1, 2017 at 4:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.