1

I have created new partition through Gparted in linux mint and now have used up all 4 primary partitions. Gparted directly created primary partition, the logical option was disabled. So I cannot create any more partitions even though there is lot of free space on my disk.

How can I convert the data partition(non system related) to a logical partition, so that it frees up a primary one? I would prefer a Linux solution, since I have recently switched to Mint 19.1 from Windows 10 though it is still present as dual boot.

Output of sfdisk:

sudo sfdisk -d /dev/sda
label: dos
label-id: 0xfc515ad7
device: /dev/sda
unit: sectors

/dev/sda1 : start=        2048, size=     1124352, type=7, bootable
/dev/sda2 : start=     1126400, size=   408475648, type=7
/dev/sda3 : start=   409602048, size=  1000001528, type=f
/dev/sda4 : start=  1409605632, size=    40960000, type=83
/dev/sda5 : start=   409602056, size=   409599984, type=7
/dev/sda6 : start=   819204096, size=    78123008, type=83      
/dev/sda7 : start=   897329152, size=     9762816, type=82
/dev/sda8 : start=   907094016, size=   195309568, type=83
/dev/sda9 : start=  1102403592, size=   307199984, type=7
  • add the output of sfdisk -d /dev/sda to your question (replace /dev/sda with the disk you want to repartition, if that's not it). Depending on how tight the partition table is, this may not be possible without moving data around. – pizdelect Feb 11 at 8:32
  • added output of sfdisk in question – Amogh Pradhan Feb 11 at 15:26
1

The partitions are spaced well enough, and you could transform the primary partitition sda4 into a logical one sda10, if you first resize the extended partition sda3.

See below for a modified table that you could use with sfdisk /dev/sda < new_partition, and for a diff showing the modifications made. After this, you should have a free slot for another primary partition (a new sda4).

However I strongly advice you to first try it on a dummy file that you could create with

 $ dd if=/dev/null of=/tmp/dummy bs=1 seek=1000G
 $ sfdisk /tmp/dummy < new_partition

Then, as root:

 # kpartx -a /tmp/dummy

The last step will let the kernel attach a loop device (/dev/loop0 if it isn't already in use) to /tmp/dummy and scan all the partitions that you have created on it. Then you could check with partitioning tools like fdisk or gparted if they're able to parse the partitioning of /dev/loop0 fine. Only after all that proceed with the

# sfdisk /dev/sda < new_partition

followed by a reboot.

You should also change any references to sda4 to sda10 (and (hd0,msdos4) to (hd0,msdos10)) in /etc/fstab and /etc/grub.d/* (the latter followed by an update-grub).

By all means, do not accuse me of anything if you're hosing your system ;-)

It may be better to wait for another answer, there are probably automated tools that could convert your partition table to GPT or such things, or more friendly partitioning programs that let you do it in a guided way.

new_partition:

/dev/sda1 : start=        2048, size=     1124352, type=7, bootable
/dev/sda2 : start=     1126400, size=   408475648, type=7
/dev/sda3 : start=   409602048, size=  1040963584, type=f
/dev/sda5 : start=   409602056, size=   409599984, type=7
/dev/sda6 : start=   819204096, size=    78123008, type=83
/dev/sda7 : start=   897329152, size=     9762816, type=82
/dev/sda8 : start=   907094016, size=   195309568, type=83
/dev/sda9 : start=  1102403592, size=   307199984, type=7
/dev/sda10 : start=  1409605632, size=   40960000, type=83

diff:

@@ -1,9 +1,9 @@
 /dev/sda1 : start=        2048, size=     1124352, type=7, bootable
 /dev/sda2 : start=     1126400, size=   408475648, type=7
-/dev/sda3 : start=   409602048, size=  1000001528, type=f
-/dev/sda4 : start=  1409605632, size=    40960000, type=83
+/dev/sda3 : start=   409602048, size=  1040963584, type=f
 /dev/sda5 : start=   409602056, size=   409599984, type=7
 /dev/sda6 : start=   819204096, size=    78123008, type=83
 /dev/sda7 : start=   897329152, size=     9762816, type=82
 /dev/sda8 : start=   907094016, size=   195309568, type=83
 /dev/sda9 : start=  1102403592, size=   307199984, type=7
+/dev/sda10 : start=  1409605632, size=   40960000, type=83

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.