sudo swapoff -a
Reformat swapfile to 2Gsudo dd if=/dev/zero of=/swapfile bs=1k count=2048k
Set permisions of filesudo chmod 0600 /swapfile
Link swap space to filesudo mkswap /swapfile
Turn on swapfile functionsudo swapon -a
Make it permanentsudo echo "/swapfile swap swap auto 0 0" | tee -a /etc/fstab