Error making swap space with mkswap [duplicate]
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
Solution 1:
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
Alternatively:
Since you only have two partitions, delete the extended partition.
Then, create a primary partition to use for swap
Solution 2:
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.