- Shrink the partition before the partition being converted. This frees up space for the extended partition table. Shrink by at least 2 megabytes.
- Note the start and end sectors of the partition you are converting, and then delete it.
- Create the extended partition. The start sector needs to be before the start sector of the partition being converted. With Linux fdisk it normally needs to be 2048 sectors (one megabyte) before, but with the
-c=dosoption it can be only 63 sectors before. There is no point in aligning the partition for an SSD, as what matters is alignment of partitions with data inside them.
- Create a new logical partition with the exact same start and end sectors of the partition you deleted. Set it to the type the old partition had.
- If the partition was bootable, you may need to fix bootability by reconfiguring the boot manager.
- Grow the partition you shrunk at the beginning, using up all the space up to the extended partition.
set root=(hd0,msdos6) set prefix=(hd0,msdos6)/boot/grub insmod normal normal
I wrote the bootloader for chain booting Linux into the first sector of the extended partition /dev/sda4. Make sure you only write the code, which is 400 bytes in that case, and don't overwrite the partition table there. This makes Linux boot if the extended partition is set to be active. Some software doesn't like when an extended partition is active, so this is just an idea, not a recommendation.