Bug 67898 - Cannot create primary partition when partition # MAXIMUM_PARTS exists
Cannot create primary partition when partition # MAXIMUM_PARTS exists
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: util-linux (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Elliot Lee
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-07-03 19:19 EDT by Leonard den Ottolander
Modified: 2007-04-18 12:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-08-02 11:03:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fdisk patch to allow creation of primary partition when (partitions >= MAXIMUM_PARTS) (1.04 KB, patch)
2002-07-04 09:00 EDT, Leonard den Ottolander
no flags Details | Diff

  None (edit)
Description Leonard den Ottolander 2002-07-03 19:19:30 EDT
Description of Problem:

The limitation of the number of partitions mentioned in bug report 56244 has the
side effect that an available primary partition cannot be created when partition
number MAXIMUM_PARTS is already created.


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

Red Hat Linux 7.3's util-linux (dunno version #).

How Reproducible:
Run fdisk on a disk that already has partition #16 created and try to create a
primary partition in available disk space.

Steps to Reproduce & Actual Results:
1. # fdisk /dev/hda

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 3737 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       383   3076416    b  Win95 FAT32
/dev/hda2           384      2933  20482875    f  Win95 Ext'd (LBA)
/dev/hda3          2934      3335   3229065    b  Win95 FAT32
/dev/hda5           384       766   3076416    b  Win95 FAT32
/dev/hda6           767      1149   3076416    b  Win95 FAT32
/dev/hda7          1150      1532   3076416    b  Win95 FAT32
/dev/hda8          1533      1596    514048+  83  Linux
/dev/hda9          1597      1635    313236   83  Linux
/dev/hda10         1636      2045   3293293+  83  Linux
/dev/hda11         2046      2086    329301   82  Linux swap
/dev/hda12         2087      2469   3076416   83  Linux
/dev/hda13         2470      2673   1638598+  83  Linux
/dev/hda14         2674      2737    514048+  83  Linux
/dev/hda15         2738      2865   1028128+  83  Linux
/dev/hda16         2866      2904    313236   83  Linux

Command (m for help): n
The maximum number of partitions has been created


When deleting /dev/hda16 the problem disappears.

Expected Results:
Being able to create primary partition in available disk space even though
/dev/hda[MAXIMUM_PARTS] has been created.
Comment 1 Leonard den Ottolander 2002-07-04 08:54:48 EDT
 Here is a patch to solve the problem. A check if a primary partition is still  
available when (partitions >= MAXIMUM_PARTS) is added to allow the creation of  
a primary partition.  
  
--- fdisk.c	Sat Oct  6 23:02:21 2001 
+++ fdisk.c.patch	Thu Jul  4 14:30:15 2002 
@@ -1879,13 +1879,28 @@ 
 		return; 
 	} 
 
+	for (i = 0; i < 4; i++) 
+		free_primary += !ptes[i].part_table->sys_ind; 
+ 
 	if (partitions >= MAXIMUM_PARTS) { 
-		printf(_("The maximum number of partitions has been created\n")); 
-		return; 
+		if (!free_primary) { 
+			printf(_("The maximum number of partitions has been 
created\n")); 
+			return; 
+		} 
+		else { 
+		// No need to offer the ability to add an extended partition 
+		// since multiple extended partitions are not supported by fdisk 
and 
+		// (partitions >= MAXIMUM_PARTS) is only true due to the 
existence 
+		// of an extended partition (or somebody set MAXIMUM_PARTS to a 
+		// silly value). 
+		// When multiple extended partitions will be supported the user 
should 
+		// be given a choice here... 
+			add_partition(get_partition(0, 4), 
+				      LINUX_NATIVE); 
+			return; 
+		} 
 	} 
 
-	for (i = 0; i < 4; i++) 
-		free_primary += !ptes[i].part_table->sys_ind; 
 	if (!free_primary) { 
 		if (extended_offset) 
 			add_logical(); 
Comment 2 Leonard den Ottolander 2002-07-04 09:00:05 EDT
Created attachment 63672 [details]
fdisk patch to allow creation of primary partition when (partitions >= MAXIMUM_PARTS)
Comment 3 Leonard den Ottolander 2002-08-02 10:15:19 EDT
 Hi. Just wondering if I anybody is looking at this bug and patch, or that it
would be wise to go upstream, which turned out to be the resolution of another bug
I posted. I know you all are very busy, it's just that the forementioned answer
took over 16 months, and this is a pretty obvious bug, and a very simple patch
(only rearranging the order of the test for the availability of a logical and if
not primary partion). Nothing fancy, but effective afaict.
Comment 4 Leonard den Ottolander 2002-08-02 10:20:01 EDT
 By the way, this bug is not a side effect of the decrease of the number of
partitions as I said earlier, it's just that due to the decrease I encountered
the bug (even I do not create 60 partitions ;).
Comment 5 Elliot Lee 2002-08-02 10:21:17 EDT
Yes, I need to get this in util-linux, just too much to do.
Comment 6 Leonard den Ottolander 2002-08-02 11:00:15 EDT
 Ok. I'll come back bugging you again in 2 months :).
Comment 7 Leonard den Ottolander 2002-08-02 11:03:06 EDT
 Or just drop the 16 partitions limit, and nobody will ever notice ;-).
Comment 8 Elliot Lee 2002-08-08 13:13:31 EDT
I forgot to note that this patch is in as of 2.11r-8

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