I am one of those Linux users who either skips SWAP during installation or assigns minimum space possible.
Reason being, now a days RAM is affordable, 2Gb RAM is common. Thus there is no logic assigning one & half OR double size of your RAM to SWAP. With routine work I hardly consume 400Mb.
So basically we do not require higher SWAP unless we use memory hogging application, e.g I want to try new Linux distro on virtual machine (although VM works on physical memory, just for example).
Create 1Gb swapfile
dd if=/dev/zero of=/tmp/swapfile bs=1MB count=1024
Create swap area
mkswap /tmp/swapfile
Enable Swapfile
swapon /tmp/swapfile
Check total size of SWAP memory.
free -m
If you wish to make it permanent enter following line in /etc/fstab
/tmp/swapfile swap swap defaults 0 0
In case you wish to remove additional swap
swapoff /tmp/swapfile
rm -rf /tmp/swapfile
Verified on 2010-05-13 for Ubuntu 10.04 LTS and it works perfect. Thanks!
Thanks for the verification. Being part time blogger I can’t test my post on diff distros.
Such comments makes my work easy.