Version of Kubuntu : 18.04
First check the status of the swap
swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 8G 7,7G -2
display information about the current state of the swap
From here create a new swap file with an other name
sudo fallocate -l 16G /swapfile2
sudo chmod 600 /swapfile2
sudo mkswap /swapfile2
Create a new swapfile
And activate it
sudo swapon /swapfile2
sudo vim /etc/fstab
Activate the new swap
/swapfile2 none swap sw 0 0
add this line to /etc/fstab
You should not have to restart your system
Remove the old swap
First deactivate your old swap (this can take some time !)
sudo swapoff /swapfile
Deactivate the old swap
Then delete the old swap file
sudo rm -rf /swapfile
Change changes in the for future
sudo vim /etc/fstab
edit the file system table and remove the reference to the old swap