Resize swap file on Ubuntu

Check you current swapfile(s):

sudo swapon --show

Disable all swapfiles:

sudo swapoff -a

Allocate space for new swapfile (/swapfile here – path to your new swapfile)

sudo fallocate -l 32G /swapfile

Change permissions for swapfile:

sudo chmod 600 /swapfile

Enable new swapfile:

sudo mkswap /swapfile

Now your swapfile updated, you can check it by using again the first command here