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

Karel Zak kzak at redhat.com
Tue Jan 24 15:38:51 UTC 2012


On Tue, Jan 24, 2012 at 09:47:46AM -0500, Phillip Susi wrote:
> 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;

 Yes, this is correct.

> 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.

 Well, 128 is minimal number of GPT partitions. If you create a new PT
 then you can allocate "arbitrary" number of partition entries. GPT
 does not have any exact number of 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.

    Karel

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com



More information about the parted-devel mailing list