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.
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
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