Skip to contentSkip to conversation

adding new logical partition in cfdisk

DISCUSSION Istvan Gabor 2 participants 2 messages Jun 18, 2017 – Jun 19, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Dear util-linux users/developers:

I have been using cfdisk for several years for editing my disks' partitions.

I noticed/read that util-linux after version ~2.23 has been completely rewritten.

Currently I have version 2.28 which comes with default openSUSE Leap 42.2.

This version doesn't show volume labels and it doesn't indicate the file systems on the partitions (eg ext3, ext4).

It would be really nice if these options could be added back to cfdisk.

There is also a problem I don't know how to solve. I have a disk with several partitions:

Device Boot Start End Sectors=20
Size Id Type
/dev/sdd1 * 2048 104859647 =20
104857600 50G 83 Linux

    /dev/sdd2                       104859648      209717247     =20
104857600        50G      83 Linux
    /dev/sdd3                       209717248      336662877     =20
126945630      60.5G      83 Linux
    /dev/sdd4                       336662878      516333837     =20
179670960      85.7G       5 Extended
    =E2=94=9C=E2=94=80/dev/sdd5                     336662941      3405666=
72       =20
3903732       1.9G      82 Linux swap / Solaris
    =E2=94=9C=E2=94=80/dev/sdd6                     340566736      3991557=
27      =20
58588992        28G      83 Linux
    =E2=94=9C=E2=94=80/dev/sdd7                     399155791      4577447=
82      =20
58588992        28G      83 Linux
    =E2=94=94=E2=94=80/dev/sdd8                     457744846      5163338=

37 =20
58588992 28G 83 Linux

Quoted 2 lines
Quoted 2 lines

Free space 516335616 625134190 =20
108798575 51.9G

I would like to add a new logical partition to the free space. I select/highlight free space, then select "New".

I set the size of the new partition:
Partition size: 28G

But cfdisk doesn't create the new partition, instead it says:
All primary partitions are in use.

How can I add new partition to the free space using cfdisk?

This worked in cfdisk 2.23.

Thanks,

Istvan

maintainer
#1 lore raw
Quoted 6 lines · Istvan Gabor

Currently I have version 2.28 which comes with default openSUSE Leap 42.2.

This version doesn't show volume labels and it doesn't indicate the file systems on the partitions (eg ext3, ext4).

There is a info box with extra information. It should be enabled by default (or possible to toggle by 'x').

Quoted 3 lines

I would like to add a new logical partition to the free space. I select/highlight free space, then select "New".

You need free space within the extended partition to create another logical partition.

Unfortunately, the current cfdisk does not support any resize operation. And the current stable libfdisk does not support extended partition resize at all ;-(

The libfdisk limitation is already fixed in the git tree, and I'd like to improve cfdisk for v2.31 too.

So there is no elegant way to use the free space behind the extended partition, but there is usable workaround:

* dump your partition table by sfdisk and create a copy

  # sfdisk --dump /dev/sdd > old-mbr
  # cp old-mbr new-mbr

* see free spaces:

  sfdisk --list-free /dev/sdd

* modify the new-mbr (text file and change size of the partition sdd4 (your extended partition) to

current_size + freespace_size

for your sdd it should be

190550817 (= 179670960 + 10879857)

* save the file and *try* use it to re-create the partition table

  sfdisk --no-act --no-reread /dev/sdd < new-mbr
         ^^^^^^^^

* if all seems OK then do it without "--no-act"

You can revert all by

    sfdisk --no-reread /dev/sdd < old-mbr

I hope for v2.30.1 it's will be possible to enlarge logical and extended partition by sfdisk and for v2.31 also by cfdisk.

Karel

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