Bug 56244 - fdisk deals with only 16 partitions (IDE disk)
Summary: fdisk deals with only 16 partitions (IDE disk)
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux   
(Show other bugs)
Version: rawhide
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Ben Levenson
: 56876 67581 74762 137666 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2001-11-14 15:58 UTC by Joao Veiga
Modified: 2007-11-30 22:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-12-17 19:27:21 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Joao Veiga 2001-11-14 15:58:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)

Description of problem:
fdisk -l on an IDE disk shows only 16 partitions (sfdisk -l works Ok). 
fdisk says it will delete partitions after 16.

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

How reproducible:

Steps to Reproduce:
1. Partition an IDE disk with more than 16 partitions
2. Install util-linux-2.11f-11.7.1
3. Run fdisk [-l] /dev/hdX
4. Compare with sfdisk [-l] /dev/hdX

Actual Results:  
zu /usr/share/doc/util-linux-2.11f # fdisk -l /dev/hdc
Warning: deleting partitions after 16

Disk /dev/hdc: 128 heads, 63 sectors, 3153 cylinders
Units = cylinders of 8064 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1      3153  12712864+   5  Extended
/dev/hdc5             1       363   1463553   83  Linux
/dev/hdc6           364       726   1463584+  83  Linux
...(removed lines from here)
/dev/hdc15         1853      1876     96736+  83  Linux
/dev/hdc16         1877      1912    145120+  83  Linux
zu /usr/share/doc/util-linux-2.11f # sfdisk -l /dev/hdc

Disk /dev/hdc: 3153 cylinders, 128 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = cylinders of 4128768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls   #blocks   Id  System
/dev/hdc1          0+   3152    3153- 12712864+   5  Extended
/dev/hdc2          0       -       0         0    0  Empty
/dev/hdc3          0       -       0         0    0  Empty
/dev/hdc4          0       -       0         0    0  Empty
/dev/hdc5          0+    362     363-  1463553   83  Linux
/dev/hdc6        363+    725     363-  1463584+  83  Linux
...(removed lines from here)
/dev/hdc15      1852+   1875      24-    96736+  83  Linux
/dev/hdc16      1876+   1911      36-   145120+  83  Linux
/dev/hdc17      1912+   3152    1241-  5003680+  83  Linux
zu /usr/share/doc/util-linux-2.11f #

Expected Results:  /dev/hdc17 should show up with fdisk too

Additional info:

kernel 2.4.14 + ext3 patch
sfdisk version 3.07 (aeb@cwi.nl, 990908)
fdisk v2.11f

maybe fdisk 'thinks' this is a SCSI disk, so this may be relevant:
advansys module not loaded when test was run

Editing the partition table with fdisk brings the warning:
Warning: deleting partitions after 16
I haven't tried to 'w', but if this warning is correct I suppose it will 
lead to loss of data (deleting partitions after 16).

Comment 1 Joao Veiga 2001-11-16 15:44:20 UTC
Oddly enough, I've downloaded the source:
installed, recompiled (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)), 
and the new fdisk works fine.

...So I've dasm'ed both binaries, and yes, the original from util-linux-2.11f-
11.7.1 is broken: When it compares MAXIMUM_PARTS to print the error message, it 
uses 15 instead of 59 (my source defines MAXIMUM_PARTS as 60 in fdisk.h):
from the "broken" fdisk:
0x0804a580 cmp    $0xf,%edx
0x0804a583 lea    0x805daa0(%edi),%ebx
0x0804a589 jg     0x0804a530
from the recompile fdisk:
0x0804a7e0 cmp    $0x3b,%edx
0x0804a7e3 lea    0x805e080(%edi),%ebx
0x0804a7e9 jg     0x0804a780

Additionaly, the fdisk binary in util-linux-2.11f-12.i386.rpm (from RH7.2) has 
the same error.

THIS IS A BIG PROBLEM (or so I think).

Comment 2 Joao Veiga 2001-12-14 12:08:13 UTC
util-linux-2.11f-17.i386.rpm has the same problem

Comment 3 Elliot Lee 2001-12-28 17:06:26 UTC
I changed MAXIMUM_PARTS from 60 to 16 because the kernel has a limit of 16

Solution: "Don't make more than 16 partitions"...?

Comment 4 Joao Veiga 2001-12-28 17:13:56 UTC
My kernel doesn't know about this limit, since I'm running with 17 partitions 
on hdc for quite a while. Wouldn't this limit apply for SCSI only?

Comment 5 Elliot Lee 2001-12-28 17:40:44 UTC
I did a bit of research. Basically:

. The absolute limit for IDE devices is 64
. The absolute limit for SCSI devices is 16.
. If you are using the BSD disklabel partition table format, the limit is 8 (16
for OpenBSD), but this is enforced separately in the fdiskbsdlabel code.

And my conclusion, in the "640k should be enough for anyone" vein, is that
anyone who needs even 16 partitions is insane, :) and that leaving the limit at
16 will make sure SCSI works properly and hopefully not inconvenience anybody.

If you can provide good reasons why > 16 partitions is the only way to solve a
problem that applies to a lot of people, we can work some sort of solution out.

Comment 6 Joao Veiga 2002-01-02 10:49:24 UTC
That's Ok, I am a bit insane then. I use a lot of IDE partitions in the 
company's samba server basically because:
- They used to reside in different (smaller) disks (and may go back). Several 
partitions give me more flexibility to move them around using labels.
- I wasn't using ext3 before, so smaller partitions made shorter fscks in the 
case of power-downs.
- I'm too lazy to use quotas to limit dept. disk usage

I got worried because previous versions of RH's fdisk did allow more than 16 
partitions (I did create my partitions with older RH releases). i.e. it was 
working, now it's broken. People using more than 16 (like me) may not notice 
the "deleting partitions above 16) warning, and end up losing data.

I also supposed that the source files would produce the same distributed 
binaries, and since in the sources the MAXIMUM_PARTS is defined as 60, I 
assumed there was something unintentionally wrong.

The solution (for me) is already worked out; everytime I update the util-linux 
rpm I get the sources and recompile fdisk separately.

I still think that it's a too dangerous change (even if for a few insane 
people) to happen with so little warning. Insane people with more than 16 
partitions per disk tend to have a lot of data.

Wouldn't it be more "elegant" to enforce the 16 limit for SCSI only? Why limit 
the functionality of a standard (IDE) just to ensure the other (SCSI) is user-
error proof?

Comment 7 Elliot Lee 2002-01-02 16:42:01 UTC
It's a slight pain to figure out whether IDE vs. SCSI vs. neither-of-the-above...

Comment 8 Elliot Lee 2002-01-03 23:39:18 UTC
*** Bug 56876 has been marked as a duplicate of this bug. ***

Comment 9 Joao Veiga 2002-01-04 10:20:20 UTC
I told you it was dangerous...

Think about this: If you leave the MAXIMUM_PARTS as it's in the source (60), 
the potential damage is smaller: People with SCSI disks won't be able to CREATE 
partitions above 16, since SCSI does not support them anyway, whereas people 
with IDE disks and more than 16 partitions (created with "normal" fdisk 
utilities) may LOOSE data which is already in the disk.

Comment 10 Elliot Lee 2002-06-27 20:32:20 UTC
*** Bug 67581 has been marked as a duplicate of this bug. ***

Comment 11 Leonard den Ottolander 2002-08-02 14:03:56 UTC
 Since the kernel allows 64 partitions on IDE drives, wouldn't it be a good idea
to check what kind of device is being fdisked and set MAXIMUM_PARTS accordingly?
Or revert to 60 allowed partitions and let fdisk provide a warning when
partitioning is done on a SCSI device? Or patch the kernel so it allows 64
partitions on SCSI devices? Not sure if that involves a lot of work, but maybe
it's just patching a const (like you did with MAXIMUM_PARTS).
 It's quite annoying to be bound to only 16 partitions on a 80GB disk with
multiple (test) installations, including some other OSes. To install 7.3 I had to
move all this data around and put some partitions together. Sure, one could patch
the installation CD, but that is a lot of effort to circumvent a restriction
that is not really necessary (IMHO:).
 Sorry for the rant, but I thought if more people would express their
"discomfort" you might actually reverse this patch :-).

Comment 12 Elliot Lee 2002-08-02 14:20:16 UTC
None of your suggestions are practical to implement.

Comment 13 Joao Veiga 2002-08-02 14:30:29 UTC
'Solution: "Don't make more than 16 partitions"...?' (from 2001-12-28 12:06:26 
above) isn't practical either, if one needs more than 16 partitions. Neither 
is: "If you have more than 16 partitions, find a distro that supports it, ours 
don't, because there is no practical solution for this. IDE supports 64 
partitions, but it was an error from someone else. It was only supposed to 
support 16, which is enough for anyone but insane people, so we just corrected 
that.". Jeez!

Comment 14 Elliot Lee 2002-10-22 13:58:20 UTC
*** Bug 74762 has been marked as a duplicate of this bug. ***

Comment 15 John McCarthy 2002-10-25 03:55:14 UTC
This is nuts.  The kernel supports 63 partitions (on IDE) just fine so user mode
tools should deal with it, sfdisk does.

On large disk systems supporting lots of partitions are very useful, especially
on multi-boot systems (e.g. RH 7.2, RH7.3, Windoz ugh).  I have 22 on my 40Gb
disk.  I use partitions for:

  - multi-boot (multi-os, multi-os versions)
  - separate data so it can have different backup cycles
  - separate directories to limit damage when something goes tries to fill disk

What's the big deal?  Testing different filesystems is another reason to
multiply partitions.

I just left Mandrake because I found it too buggy for my tastes--don't send me
back for such a silly limitation.  What is the problem with SCSI and 16
partitions?  Does it have a bad failure mode or something?  Won't it just
complain when you try to add number 17?

At least deal with a disk that already has >16 partitions on it since it must be
supported (and IDE) in that case.  Report all partitions.

Comment 16 Joao Veiga 2002-10-25 11:49:31 UTC
SCSI only supports 16 partitions, so although IDE supports more, fdisk has 
this silly limit. 

Hey, my floppy disk only supports 1.44MB, why then fdisk allows partitions 
bigger than that?

If someone has a HUGE disk, with say, 25 partitions, and try to add some more 
on available space with fdisk, he'll have all his partitions above 16 
DELETED!! He's only protected by a warning. SOOOO, why not do the opposite: 
Set MAXIMUM_PARTS to 64, and whenever one adds partitions above 16, you 
warn: "If this is a SCSI disc, that won't work". Is that "not practical to 

Comment 17 David Balažic 2003-10-23 14:11:59 UTC
If 16 is the "one true limit", then why does sfdisk allow for more ?
Why does the kernel allow for more ?
Why does anaconda ( disk druid ) allow for more ?

Fix them or fix fdisk !

Comment 18 Joao Veiga 2003-12-18 09:51:45 UTC
This was marked as "WONT FIX".

That's Ok, I don't care anymore. I'm going Debian...

Comment 19 Elliot Lee 2004-11-01 15:31:14 UTC
*** Bug 137666 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.