I'm trying to extend partition /dev/sda5 which is logical partition under extended partition /dev/sda2.
I want to use fdisk.
Procedure should be to delete both partitions and then to recreate them with exact same starting sectors (1001470 & 1001472). It goes well until creating logical partition where minimum starting sector is bigger (1003518) than it needs to be.
$ sudo fdisk /dev/sda Command (m for help): p Disk /dev/sda: 9.8 GiB, 10485760000 bytes, 20480000 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: 0x0cd7105f Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 999423 997376 487M 83 Linux /dev/sda2 1001470 16775167 15773698 7.5G 5 Extended /dev/sda5 1001472 16775167 15773696 7.5G 83 Linux Partition 5 has been deleted. Partition 2 has been deleted. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): e Partition number (2-4, default 2): First sector (999424-20479999, default 999424): 1001470 Last sector, +sectors or +size{K,M,G,T,P} (1001470-20479999, default 20479999): Created a new partition 2 of type 'Extended' and of size 9.3 GiB. Command (m for help): n All space for primary partitions is in use. Adding logical partition 5 First sector (1003518-20479999, default 1003520): 1001472 Value out of range.
I have done it with parted, but it should be possible with fdisk somehow.
$ fdisk -V
fdisk from util-linux 2.27.1