On my el7 VirtualBox VM I increased the size of the hard disk, and now I want to use that space to create a new logical partition. However, I'm at a loss how to do this.
Here's fdisk's view of my current partition table:
# fdisk -l /dev/sda
Disk /dev/sda: 68.7 GB, 68719476736 bytes, 134217728 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
Disk label type: dos
Disk identifier: 0x000e58d8
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 67108862 16777215+ 83 Linux
/dev/sda4 67108863 100663295 16777216+ f W95 Ext'd (LBA)
/dev/sda5 67108864 100663295 16777216 83 Linux
So, I have a DOS-style partition table, with three primary partitions, and one extended partition. In that last extended partition I have one logical partition, and now I want to create a second logical partition. To do this I use fdisk to delete those last partitions, 5 and 4, and then create a new extended partition 4 that's bigger, using all the new space I added to the disk. Then I want to recreate partition 5 as it currently is already, and then finally add my new partition 6 to use the new space.
What seems to be stopping me is that the extended partition is this annoying "W95 Ext'd (LBA)" partition type. I didn't do that intentionally, that's just how it got created. Anyway, I'm able to delete partitions 5 and 4, and then create a new extended partition 4. The problem at that point is that the new partition 4 is not the same type. Here's what I end up with:
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 67108862 16777215+ 83 Linux
/dev/sda4 67108863 134217727 33554432+ 5 Extended
Partition 4 is recreated with the desired new size, but the partition type is wrong. It's now type 5, "Extended." fdisk has a function to change the partition type id, but that doesn't work. When I invoke that option to change the type to "f" I get:
You cannot change a partition into an extended one or vice versa.
Delete it first.
If I just leave the type of the new partition 4 as-is, then I can't recreate logical partition 5 using the same starting sector it's currently on, apparently because the type 5 "Extended" partition type needs more headroom, or something.