The free space and your existing Linux partition are not contiguous, so you can't simply merge them. Linux's own partition scheme, LVM, allows a filesystem to be split between separate location on the disk or even between disks. But native MBR or GPT partitions have to be a single contiguous area.
Moving the partition in the middle would be complicated because there isn't enough space for a non-overlapping move. Unless you move it to another disk and then back, I recommend switching Linux to use LVM, which has other benefits as well.
The tool blocks (formerly lvmify) by Gabriel can convert an existing partition in place. Run it from a live CD/USB.
blocks to-lvm --vg-name=mint /dev/sda6
lvrename mint sda6 root
This will make your system unbootable, so you need to do one more thing before you reboot. Mount the volume and get ready to run commands in Mint via chroot:
mkdir /media/root
mount /dev/mapper/mint-root /media/root
mount --rbind /proc /media/root/proc
mount --rbind /dev /media/root/dev
mount --rbind /sys /media/root/sys
chroot /media/root
Run update-grub
and update-initramfs
. Now your system will have the necessary drivers at boot time to boot from LVM.
You can now reboot to your Linux installation and add more space to the LVM volume. Create a partition /dev/sda8
encompassing the space you want to use. If asked for a partition type, select LVM physical volume. Then run the following commands to add the space to your root partition.
pvcreate /dev/sda8
vgextend mint /dev/sda8
lvextend mint/root /dev/sda8
resize2fs /dev/mapper/mint-root
Best Answer
That's because you have unallocated space outside of the extended partition (
sda3
) which contains the partition you want to extend (sda5
) so I would:sda3
to the left (this will move bothsda5
andsda6
as well)sda3
with the now free space at the endsda6
to the end ofsda3
sda5
still leaving 10% of the disk space unallocated betweensda5
andsda6
²Note 1: Yes, take a backup! If you have a power failure in any of the following steps, your entire disk is toast!
Note 2: That leaves you some wriggling room to extend your swap or your data (or both) in an emergency.
Note 3: Yes, you can also extend
sda3
to the left and then extendsda5
to the left but that will not give you the 10% spare (unallocated) space for emergency extension in the future and the entire process is going to take all night anyway.