linux fdisk doesn't allow to re-create partition starting at the same address

3

I have a partition which is too small for it's needs, so I want to recreate it as a bigger partition. For this I want to delete it first, and than create it again, starting at the same address, but ending in a farther one. Here is my current partition table:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x55ad22b5

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048  20322303  20320256   9.7G 27 Hidden NTFS WinRE
/dev/sda2  *     20322304  21039103    716800   350M  7 HPFS/NTFS/exFAT
/dev/sda3        21039104 771971119 750932016 358.1G  7 HPFS/NTFS/exFAT
/dev/sda4       771973118 976771071 204797954  97.7G  5 Extended
/dev/sda5       771973120 791502847  19529728   9.3G 83 Linux
/dev/sda6       791504896 798986239   7481344   3.6G 82 Linux swap / Solaris
/dev/sda7       798988288 976771071 177782784  84.8G 83 Linux

Partition 4 does not start on physical sector boundary.

Note a tell-tale message regarding physical sector boundary on partition 4. The partition I want to enlarge is partition 5 (Linux).

This is what happens after I delete all the logical partitions (to make space for the enlarged partition)

Command (m for help): p
...

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048  20322303  20320256   9.7G 27 Hidden NTFS WinRE
/dev/sda2  *     20322304  21039103    716800   350M  7 HPFS/NTFS/exFAT
/dev/sda3        21039104 771971119 750932016 358.1G  7 HPFS/NTFS/exFAT
/dev/sda4       771973118 976771071 204797954  97.7G  5 Extended

But, when I try to create it anew:

Command (m for help): n

All primary partitions are in use.
Adding logical partition 5
First sector (771975166-976771071, default 771975168): 771973120
Value out of range.
First sector (771975166-976771071, default 771975168): 

I can not create it at the same start as the original one. I can't remember exactly how I created those. Is there any way for me to recreating the partition the way I want it to be? Or may be there is some other way to enalrge the partition?

SergeyA

Posted 2017-11-10T03:21:47.363

Reputation: 150

As noted by rknichols, you might be using swap partition /dev/sda6 at the time you are trying to overwrite it. Try swapoff -av, delete /dev/sda5, /dev/sda6, and /dev/sda7 and then try to re-create /dev/sda5. I'd also suggest that you leave some space for new swap partition /dev/sda6, create it, and then run mkswap /dev/sda6 and swapon -av.

– doriclazar – 2017-11-10T05:00:59.317

Are you sure you have deleted parttions 5 and 6? Why is FDisk trying to create logical partition 7 and not 5? – davidgo – 2017-11-10T06:20:48.587

@doriclazar, may be this is the issue, but I probably need to mention that I do not save partitions in between deleting and creating a new one. – SergeyA – 2017-11-10T15:12:06.593

@davidgo my bad! It is a wrong copy-paste. I will edit the text tonight to be sure I copy-pasted correctly from home machine. But I did delete partitions when doing it properly. – SergeyA – 2017-11-10T15:13:14.093

@davidgo, just made the change. It was indeed partition 5 in correct case, and numbers are the same. – SergeyA – 2017-11-11T03:30:45.480

No answers