Note: The above screenshot is just a reference point, lol-SWAP partition RIP!
If we’re talking about bare metal and desktops/laptops then this might be the next impossible solution on a given Linux/Unix machine, but there are a few workarounds and the best one i feel is supposed to use Gparted tool. Now there are a few hiccups here and there. This tool may not permit to perform the above task.
Here is a neat explanation below from one of the forums out there…
gparted may not allow you to resize the mounted & active root / partition when you are logged into Ubuntu (i.e. mounted /). There are many solutions to resize the root partition depending on your knowledge and experience.
However, I would suggest using the gparted live CD. Burn the iso to USB or CD and boot your system from it. Once booted, you can make changes to the root partition and the root filesystem. Bonus for using gparted is that it gives you GUI.
Tips:- Use at-least 8 GB USB thumb drive or more and if you wanna feel nerdy use the dd command straight from your terminal to flash the stick. Alternatively using etcher.io and mintstick or popsicle or Start Up Disk Creator as seen on Ubuntu shall definitely come handy.