I selected one partition to delete in fdisk but as you see the 3rd partition which is swap is deleted too, why?
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 12584959 12582912 6G 83 Linux
/dev/sda2 12587006 20969471 8382466 4G 5 Extended
/dev/sda5 12587008 20969471 8382464 4G 82 Linux swap / Solaris
Command (m for help): d
Partition number (1,2,5, default 5): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 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: 0xd2dfe316
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 12584959 12582912 6G 83 Linux
Command (m for help):
That is because
/dev/sda5
is your only logical partition inside/dev/sda2
, which is a extended partition. So by removing your extended partition, your logical partition will be removed as well./dev/sda2
was an extended partition and/dev/sda5
was a logical partition residing inside of it. You can see that the Start and End positions of/dev/sda5
overlap with/dev/sda2
.If this is not what you intended, you can still quit
fdisk
without applying changes by using theq
command.