Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a Linux Virtual Machine that I recently setup, I had a disk (/dev/sdb) of size 20G in which I created 8 partitions (3 primary, 1 extended containing 5 logical partitions), using up to 10G of space. So there's 10G unpartitioned.

I can't use fdisk as the maximum allowable partitions 4 already created. Is there any other way to create new partitions on the remaining 10G space, without modifying or deleting existing partitions?

I could add a new disk /dev/sdc and use it, but I want to see what else can be done on /dev/sdb.

share|improve this question
up vote 1 down vote accepted

Before attempting to create a new partition, you have to grow the existing extended partition to fill the whole space and then create a new logical partition inside the extended partition.

share|improve this answer

You should be able to use fdisk to add an extended partition with no trouble. I've done so a number of times in Ubuntu as well as in several other ancient distros. But I prefer the graphical program GParted. It's available as a live CD if you don't have X installed.

share|improve this answer
Actually i couldn't, it says 'No free sectors available'. It would have been possible if i had atleast one spare primary partition, but i've used all 4 of them already – Jay Sep 18 '12 at 5:08
In that case, you're doing something wrong. The fact that you're up to the limit tells me that you're still trying to create a primary partition instead of a logical one. – Scott Severance Sep 18 '12 at 8:11
$fdisk /dev/sdb | Then, command (m for help): n | No free sectors available | I need to type 'n' followed by 'p' or 'l' to create a primary or logical partition right? Can't get there. – Jay Sep 19 '12 at 1:45
Are you sure that you have free space on the disk? If fdisk can't do it, then it probably can't be done. I suspect that there's a misconfiguration somewhere. Please post the results of a session, including printing the partition table. Alternatively, try GParted. It's much easier than fdisk. I used fdisk a lot back in the day, but I now use GParted nearly exclusively. It's that much easier. – Scott Severance Sep 19 '12 at 15:31

Extended partition take one logical partition by itself, It's why it is called extent, it take one logical and permit to repartition it's content.

My advice would be to swapoff, delete swap. Resize root to take place of the swap, then create your extended partition, at the end of it, create your new swap. It doesn't matter if it is on extent.

Modify your fstab accordingly and you're done.

share|improve this answer

You could use gdisk to convert the Virtual Hard Drive to GPT. GPT allows a virtually unlimited amount of partions. gdisk operates just like fdisk, but has more options. Install Gdisk (With Ubuntu/Debian use apt-get install gdisk), then run it. (gdisk /dev/sda)

Replace sda with your hard drive then just browse the help menus, they are pretty simple.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .