Linux – How to move a primary partition into an extended one

boothard drivelinuxpartitioning

My installation is Fedora 18 and Windows 8, and I need room for another system.

I have a very delicate task: I need to move my primary /boot partition inside an extended partition which contains all other system's partitions (home, root and swap). Layout is as follows:

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      718847      358400    7  HPFS/NTFS/exFAT
/dev/sda2          718848    84604927    41943040    7  HPFS/NTFS/exFAT
/dev/sda3        84604928    85628927      512000   83  Linux
/dev/sda4        85628928   883879935   399125504    5  Estendida
/dev/sda5        85630976    92938239     3653632   82  Linux swap / Solaris
/dev/sda6        92940288   197797887    52428800   83  Linux
/dev/sda7       197799936   883879935   343040000   83  Linux

If an image is preferred (it is in portuguese):
GParted print screen

I have much more empty space than used space, if needed, as seen in the screenshot, and I also have an external drive with more than 250G free. I want to have boot partition inside the extended, if possible. Fedora by default uses the most possible primary partition quantity, and I want to free one up to install another OS. Another very wanted solution would be to move Windows' partitions inside an exclusive extended partition, as I think Windows' boot partition is not used (I use GRUB as bootloader).

Best Answer

Linux can boot from a logical partition just fine. There are a handful of partitioning programs that can convert primary partitions to logical partitions and vice-versa, but there are often (perhaps always) limits. The program I'm most familiar with for this task is my own FixParts. I recommend you read its Web page to learn how to use it.

In your case, the major problem is that there's no free space between your /dev/sda2 and /dev/sda3. Thus, you'll need to shrink one of these partitions to create some free space -- just one sector is plenty, but you'll probably have to shrink it by 1MiB. GParted can do this job, but there is a caveat: Windows can be pretty fussy about its boot partition. If you're booting from /dev/sda2, it could be rendered unbootable by shrinking that partition in GParted. Thus, it might be better to do this from Windows. Once there's unallocated space just before /dev/sda3, FixParts should have no problems converting it to a logical partition inside your extended partition.

Related Question