gparted: how to merge unallocated space with a partition

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:

  1. Take a full system backup using CloneZilla Live¹
  2. Boot a live environment of gparted
  3. Move sda3 to the left (this will move both sda5 and sda6 as well)
  4. Extend sda3 with the now free space at the end
  5. Move sda6 to the end of sda3
  6. Extend sda5 still leaving 10% of the disk space unallocated between sda5 and sda6²

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 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.

Tags:

Gparted