I want to merge unallocated space to an ext4 partition. But gparted seems to prevent this. I cannot extend the partition.
see screenshot: merge unallocated with sda5.
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:
sda3to the left (this will move both
sda3with the now free space at the end
sda6to the end of
sda5still leaving 10% of the disk space unallocated between
Note¹: Yes, take a backup! If you have a power failure in any of the following steps, your entire disk is toast!
Note²: That leaves you some wriggling room to extend your swap or your data (or both) in an emergency.
Note³: Yes, you can also extend
sda3 to the left and then extend
sda5 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.
That image has a colored, not a greyed out checkmark for apply.
That means you need to apply the pending actions and reboot.
Dont try to shrink the unallocated space.
And of course reboot again.