This question already has an answer here:

I am running VM Workstation 12 Player and have installed Ubuntu 16.10 on the VM. I have made an extended partition for the swap space after having had to remove the swap partition in order to extend the primary partition space.

I enter

fdisk -l

and get

Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7d4da0a8

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 157700095 157698048 75.2G 83 Linux
/dev/sda2       157700096 159793151   2093056 1022M  5 Extended

Yet, when I type

sudo mkswap /dev/sda2

I get

mkswap: error: swap area needs to be at least 40 KiB

It seems that I have just over 1 GB of space on /dev/sda2

marked as duplicate by George Udosen, waltinator, karel, Charles Green, storm Oct 8 '17 at 11:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • An Extended partition is for holding other partitions within it - it's not useable disk space. – waltinator Oct 7 '17 at 15:03
  • 1
    btw, please upgrade! 16.10 is unsupported – Zanna Oct 7 '17 at 19:19

the extended partition isn't a true partition, it is a container for logical drives.

You need to create a logical drive within the extended partition that uses all space.

then use that for the swap partition


Since you only have two partitions, delete the extended partition.
Then, create a primary partition to use for swap

  • Or just change the type of the extended partition (which is a partition in the sense of being in the MBR partition table) to 'Linux Swap' so it doesn't show up as an extended partition. – abligh Oct 8 '17 at 10:37

Your /dev/sda2 is an extended partition which acts as a kind of container to hold further logical partitions which can be used. The extended partition cannot be used directly.

So either partition /dev/sda2 as a primary partition or create a logical partition within the extended partition.

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