Let's read the fine source.
In block/partitions/efi.c
, the place to set up gpt partitions is efi_partition()
. Here decides the maximum number of partitions:
for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) {
num_partition_entries
comes from gpt header on the disk, so the maximum number is state->limit - 1
. state
is the argument of this function, and this function is called from check_part()
, from check_partition()
in the same file, and there comes
state->limit = disk_max_parts(hd);
So the limit is disk_max_parts()
,
static inline int disk_max_parts(struct gendisk *disk)
{
if (disk->flags & GENHD_FL_EXT_DEVT)
return DISK_MAX_PARTS;
return disk->minors;
}
So if the disk device has GENHD_FL_EXT_DEVT /* allow extended devt */
(loop device, generic ATA/ATAPI disk, SCSI disk, MD RAID), the limit is DISK_MAX_PARTS
(256), otherwise it's minors
.
In conclusion, usually the maximum number Linux kernel supports is 255.