xxxxxxxxxx
# Turn off all swap processes
sudo swapoff -a
# Resize the swap (from 512 MB to 8GB)
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
# Make the file usable as swap
sudo mkswap /swapfile
# Activate the swap file
sudo swapon /swapfile
# Check the amount of swap available
grep SwapTotal /proc/meminfo
xxxxxxxxxx
https://docs.rackspace.com/support/how-to/create-remove-swap-file-in-ubuntu/
//changes on this line only
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 oflag=append conv=notrunc
The above command will append 1GiB of zero bytes at the end of your swap file.