Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was wondering what is the maximum number of partition on an GPT-partitionned drive under Linux.

The GPT partition table can contain up to 128 partitions, but the device nodes for /dev/sda? (as described here, block device of major number 8) only allow /dev/sda1 up to /dev/sda15.

Does that means that there cannot be more that 15 partitions on a drive, even on a GPT-partitionned drive?

share|improve this question

3 Answers 3

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.

share|improve this answer

Well, I think that's where using UUIDs comes in to play. In that case, you don't address a block device as /dev/{h,s}dXY but rather, by the device's UUID. Certainly in that case, the limit would be supremely beyond excess of 128.

share|improve this answer

No, it means that Linux has a problem. ☺ But we knew that already.

Who told you that the EFI partition table contains up to 128 partitions? That person cannot read specifications. As I've said before, 128 entries of 128 bytes each is the minimum size that is required by the EFI Specification, not the size of an EFI partition table, and certainly not the maximum size.

(Strictly speaking the minimum, first mentioned in version 1.10 of the EFI Specification, is 16KiB total for all partition entries, but not including the header block. With the conventional 128 byte entry length, that's a minimum of 128 entries.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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