Adding Swap File to Currently Installed Ubuntu OS
1. Create a file with a size you prefer. # sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512 2. Format the created file # sudo mkswap /mnt/512Mb.swap 3. Add the swap to the running system. # sudo swapon /mnt/512Mb.swap to check if the swap file has been activated use # cat /proc/meminfo or # free -t 4. To make the swap permanent every other boot. # gksudo gedit /etc/fstab Add the line at the end of the file /mnt/512Mb.swap none swap sw 0 0 5. Save and reboot the system. source: help.ubuntu