Bug 137666

Summary: fdisk no longer allows creation of more than 16 logical partitions on an IDE disk
Product: Red Hat Enterprise Linux 3 Reporter: greg hosler <greg>
Component: util-linuxAssignee: Elliot Lee <sopwith>
Status: CLOSED DUPLICATE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-21 19:06:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description greg hosler 2004-10-30 12:13:33 UTC
Description of problem:

The maximum number of partitions on an IDE disk is 63. i.e. hda goes
from hda1 thru and including hda63 (as opposed to scsi, where the
maximum # of partitions is 15).

fdisk from util-linux-2.11y-31.1 does not allow the creation of more
than 16 partitions. Once you have created /dev/hda16, fdisk refuses
to prompt you if you want to create a logical partition.

Version-Release number of selected component (if applicable):

util-linux-2.11y-31.1

How reproducible:

every time

Steps to Reproduce:
1. grab a disk. mine is 120gb, but I believe a small one will do fine.
2. run fdisk. make an extended partition. then make 17 partitions
each of 1 cylinder (i.e. "+1" for the size).
3. after the 12th (i.e when hda16 is created), fdisk will no longer
   allow you to create any more logical partitions.
  
Actual results:

cannot create partitions > 16.

Expected results:

can create more than 16 partitons on todays large hard ide drives.

Additional info:

Comment 1 greg hosler 2004-10-30 13:13:45 UTC
I looked into the SRPM, and discovered, low and behold, the reason
for this bug is the following:

    util-linux-2.11r-miscfixes.patch

has the following patch:

   .
   .
   .

-#define MAXIMUM_PARTS  60
+#define MAXIMUM_PARTS  16

This is definately wrong. IDE's have up to 63 partitions. SCSI's are
limited to 15. Red Hat specifically delivers /dev/hda's with 32
inode's defined (hda, hda1 thru hda32), with the ability to create
from 32 thru 63 via mknod.

while I'll agree that 60 is alot to allow, it is legal, and 16 is
way to small a number for an all to common largish ide these days.
(especially when one goes to divide it up for multiple os's, or in
my case, multiple Red Hat installations. I'm a RHCX, and I need
multiple installations (test system, instructor system, exam system,
etc!)

that patch ought to be corrected to allow for more that 16 partitions...



Comment 2 Elliot Lee 2004-11-01 15:31:03 UTC
16 is the limit for other devices such as SCSI ones, and there's no
way to know what the limit is for a particular device, so the limit of
16 has to be global.

*** This bug has been marked as a duplicate of 56244 ***

Comment 3 greg hosler 2004-11-02 12:36:49 UTC
16 is NOT 'the limit for other devices, such as SCSI'. 15 is the
limit. At present, fdisk allows the creation of /dev/sda16, which is a
non-existant, non-addressable partition. (device node 8,16 is /dev/sdb,
not /dev/sda16)!

Truth be told, there *is* a way to tell the limit of a device, to the
extent that there is a way to get the inode of the device. While I am
not recommending this, one could fstat (or lstat) argv[1], and using
the major number, index into a hard coded table, that listed each of
the scsi major numbers, and for those set the limit to 15, and 63
otherwise. (or conversly, use the ide major numbers in the hard-coded
table). nearther option is particularly attractive. I detest hard
coded numbers in tables. Another possible solution is that given
device argv[1], see which of the partition inodes exist, and
minimally, allow the creation of partitions for any partition which
exists. (e.g. for (i=1; i<64; i++) {does argv[1]$i exist} Not perfect,
but certainly much better than an arbitrary cut-off, which happens to
be the wrong value anyway!



Comment 4 Elliot Lee 2004-11-02 15:54:41 UTC
Thanks for pointing out the actual SCSI limit...

As you stated, the ideas for finding the per-device limit are not that
great. (The second one won't work quite right for devices such as the
/dev/cciss/* ones.)

parted appears to limit partition tables to 16 partitions, so I'm in
good company. I can't see anywhere where it does a per-device limit.
sfdisk seems to enforce no limit at all.

Comment 5 Red Hat Bugzilla 2006-02-21 19:06:42 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.