[parted-devel] [PATCH 1/2] libparted: enforce dos partition limit

Phillip Susi phillsusi at gmail.com
Tue Jan 24 14:47:46 UTC 2012


On 1/24/2012 5:00 AM, Karel Zak wrote:
> On Mon, Jan 23, 2012 at 10:39:20AM -0800, H. Peter Anvin wrote:
>> Newer Linux kernel s have an overflow system which is at least supposed
>> to allow for additional partitions without problems; if that is broken
>> then that is a kernel bug, and playing games in parted will just make it
>> harder to diagnose and fix.
> 
>  +1  ...I don't understand why we need to define any limits in
>  userspace if all depends on kernel; and don't forget that the
>  "kernel" is something petty vague defined in this context. You
>  can reboot to another system, update kernel, move the disk, ...

It doesn't depend on the kernel.  libparted keeps track of two different
limits: one that is the kernel limit, and one that is the partition
table limit.  They are independent of one another.  Usually gpt allows
128 partitions.  Whether the kernel can handle that many is another
issue, and the only difference it makes to libparted is whether it can
inform the kernel about all of the partitions listed in the table or
not.  If the kernel only supports 16 partitions, then you can still
create all 128 in the partition table; you just won't get block devices
for more than 16.  If the kernel supports 256 partitions, then you still
can not create more than 128 partitions ( usually ) because gpt (
usually ) only has 128 slots.

The issue here is whether the limit that the dos partition table reports
is true, and what that limit should be, since you theoretically can nest
as many logical partitions as you want.  Pick any number you like, as
long as it really is a limit ( meaning there will never be more
partitions than that ), then the bug is resolved.



More information about the parted-devel mailing list