Bug 28417

Summary: cfdisk creates duplicate partition
Product: [Retired] Red Hat Linux Reporter: David Balažic <david.balazic>
Component: util-linuxAssignee: Elliot Lee <sopwith>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
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: 2001-08-09 09:39:47 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:
Attachments:
Description Flags
screenshot of cfdisk before the new partition is added
none
screenshot of cfdisk after the new partition was created none

Description David Balažic 2001-02-20 12:49:27 UTC
My disk has the partitions hda1, hda2 <hda5-10>

When I try to add a new partition in cfdisk, using the free disk space,
the new partition gets the name hda8 and the old hda8 is renamed to hda9,
giving two hda9's !

I'm using cfdisk from util-linux-2.10p-4 on Fisher/i386.

cat /proc/ide/hda/geometry :
physical     39560/16/63
logical      2482/255/63

fdisk -l -u /dev/hda :
kernel version 132097

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

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       255   2048256    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary:
     phys=(1023, 0, 63) should be (1023, 254, 63)
/dev/hda2           256      2482  17888377+   f  Win95 Ext'd (LBA)
Partition 2 does not end on cylinder boundary:
     phys=(1023, 13, 63) should be (1023, 254, 63)
/dev/hda5           256       892   5116671    7  HPFS/NTFS
/dev/hda6           893      1283   3138754+   7  HPFS/NTFS
/dev/hda7          1283      1665   3070305    7  HPFS/NTFS
/dev/hda8          2300      2482   1469947+   c  Win95 FAT32 (LBA)
/dev/hda9          1666      1716    409626   82  Linux swap
/dev/hda10         1717      2000   2281198+  83  Linux

Partition table entries are not in disk order


sfdisk -l /dev/hda :

Disk /dev/hda: 2482 cylinders, 255 heads, 63 sectors/track
Warning: The first partition looks like it was made
  for C/H/S=*/1/63 (instead of 2482/255/63).
For this listing I'll assume that geometry.
Units = cylinders of 32256 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls   #blocks   Id  System
/dev/hda1   *      1   65024   65024   2048256    7  HPFS/NTFS
		start: (c,h,s) expected (1,0,1) found (0,1,1)
/dev/hda2      65025  632909  567885  17888377+   f  Win95 Ext'd (LBA)
		start: (c,h,s) expected (1023,0,63) found (1023,1,1)
		end: (c,h,s) expected (1023,0,63) found (1023,13,63)
/dev/hda3          0       -       0         0    0  Empty
/dev/hda4          0       -       0         0    0  Empty
/dev/hda5      65026  227459  162434   5116671    7  HPFS/NTFS
		start: (c,h,s) expected (1023,0,63) found (1023,2,1)
		end: (c,h,s) expected (1023,0,63) found (1023,3,63)
/dev/hda6     227461  327103   99643   3138754+   7  HPFS/NTFS
		start: (c,h,s) expected (1023,0,63) found (892,1,1)
		end: (c,h,s) expected (1023,0,63) found (1023,193,63)
/dev/hda7     327105  424574   97470   3070305    7  HPFS/NTFS
		start: (c,h,s) expected (1023,0,63) found (1023,195,1)
		end: (c,h,s) expected (1023,0,63) found (1023,254,63)
/dev/hda8     586245  632909   46665   1469947+   c  Win95 FAT32 (LBA)
		start: (c,h,s) expected (1023,0,63) found (1023,254,63)
		end: (c,h,s) expected (1023,0,63) found (1023,254,63)
/dev/hda9     424576  437579   13004    409626   82  Linux swap
		start: (c,h,s) expected (1023,0,63) found (1023,254,63)
		end: (c,h,s) expected (1023,0,63) found (1023,254,63)
/dev/hda10437581  509999   72419   2281198+  83  Linux
		start: (c,h,s) expected (1023,0,63) found (1023,254,63)
		end: (c,h,s) expected (1023,0,63) found (1023,254,63)

sfdisk -d /dev/hda :
# partition table of /dev/hda
unit: sectors

/dev/hda1 : start=       63, size= 4096512, Id= 7, bootable
/dev/hda2 : start=  4096575, size=35776755, Id= f
/dev/hda3 : start=        0, size=       0, Id= 0
/dev/hda4 : start=        0, size=       0, Id= 0
/dev/hda5 : start=  4096638, size=10233342, Id= 7
/dev/hda6 : start= 14330043, size= 6277509, Id= 7
/dev/hda7 : start= 20607615, size= 6140610, Id= 7
/dev/hda8 : start= 36933435, size= 2939895, Id= c
/dev/hda9 : start= 26748288, size=  819252, Id=82
/dev/hda10: start= 27567603, size= 4562397, Id=83

I also attached the screenshots of cfdisk before and after the change.
Note that I never saved the "weird" partition tables from cfdisk to disk !

Comment 1 David Balažic 2001-02-20 12:50:47 UTC
Created attachment 10462 [details]
screenshot of cfdisk before the new partition is added

Comment 2 David Balažic 2001-02-20 12:54:31 UTC
Created attachment 10463 [details]
screenshot of cfdisk after the new partition was created

Comment 3 David Balažic 2001-02-20 12:57:41 UTC
I created the new partition by selecting the free space,
pressin [N]ew and accepting the offered size ( the entire free space ).


Comment 4 Elliot Lee 2001-07-17 23:17:23 UTC
I'm not sure if cfdisk is even recommended for use - I vaguely recall that there
were some disk features that only fdisk could handle. I'm curious if everything
works properly if you use fdisk?

Apologies for the unresponsiveness of the previous util-linux packager...

Comment 5 Elliot Lee 2001-08-08 05:14:32 UTC
No response, can't blame the dude, can't fix the problem.

Comment 6 David Balažic 2001-08-09 09:39:38 UTC
Seems like cfdisk is confused when partitions are not in physical order.

Here is how to reproduce it without harming your hard drive :
1. dd if=/dev/zero of=testfile bs=1024 count=80
2. mv /dev/hde /dev/hde.backup
3. mv /dev/loop0 /dev/hde
4. losetup /dev/hde testfile
5. fdisk /dev/hde # enter the following commands :
x
s
1
h
1
c
80
r
o
n
p
1
2
10
n
e
2
11
80
n
l
12
20
n
l
60
70
n
l
22
30
w
*EOF* # do not enter this
6. cfdisk /dev/hde :
 - select the free space between hde7 and hde6, press 'n', press ENTER,
voila , two hde7 partitions listed !
7. to clean up : losetup -d /dev/hde ; mv /dev/hde /dev/loop0 ; 
mv /dev/hde.backup /dev/hde
rm testfile

8. fdisk and cfdisk were from util-linux-2.10s-12.rpm this time


Comment 7 Elliot Lee 2001-08-26 21:38:04 UTC
This is a good explanation of the problem, but the response remains as before -
use fdisk, not cfdisk.

Sorry about the confusion, I've removed cfdisk from the util-linux package so
that this type of confusion doesn't happen again.