Skip to contentSkip to conversation

cfdisk wipes out partition table when trying to replace a single logical partition

DISCUSSION Michał Górny 2 participants 2 messages Aug 25, 2014 – Aug 26, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

(please CC me on replies)

Hello,

I'm afraid I've hit a bug that has been introduced in 2.25 and still not fixed in current git.

I start with the following disk layout:

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 63 93755339 93755277 44.7G 7 HPFS/NTFS/exFAT
/dev/sdb2 93755392 234439534 140684143 67.1G 5 Extended
/dev/sdb5 93757440 135700479 41943040 20G 83 Linux

Now I start cfdisk and remove sdb5, and create a larger partition on top of it. At this point, cfdisk shows correct disk layout (sdb1, sdb2 and new sdb5), so I save it. However, the partition table written to disk is incorrect:

Device Boot Start End Sectors Size Id Type
/dev/sdb1 93757440 146186239 52428800 25G 83 Linux

As far as I can see, cfdisk removed both the primary and extended partitions, and wrote my new logical partition as primary. As you can guess, this is rather unexpected and undesired.

I can consistently reproduce the issue.

Signature · 2 lines
Best regards,
Michał Górny
maintainer
#1 lore raw
Quoted 2 lines · Michał Górny

I'm afraid I've hit a bug that has been introduced in 2.25 and still not fixed in current git.

Yep, it's pretty ugly bug. Fixed. We need 2.25.1 really ASAP.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com