Create a swapfile with blocksize 1024 and 2GB
dd if=/dev/zero of=/swap/swapfile bs=1024 count=2MFormat the file and set permissions
mkswap /swap/swapfile chown root:root /swap/swapfile chmod 600 /swap/swapfileAdd the swapfile to swap
swapon /swap/swapfile
List the swapfiles
swapon -sTurn off the swapfile (used swap will be moved to other swap or memory, might take a while)
swapoff /swap/swapfile
Discussion