On debian the steps to add a regular file for swapping were as follows:
- make the swap file - create a contiguous file and label it as such
- Mount it as a swap partition
- Add it to /etc/fstab
dd if=/dev/zero of=fourGfile count=4000000 bs=1024
chmod 0600 fourGfile
mkswap fourGfile
swapon -v fourGfile
/var/cache/swapfile/fourGfile none swap sw 0 0
This was it and now we have enough swap on the systems,
bash-3.1# free -l
total used free shared buffers cached
Mem: 8180284 7866476 313808 0 84660 7323408
Low: 8180284 7866476 313808
High: 0 0 0
-/+ buffers/cache: 458408 7721876
Swap: 7951784 95304 7856480
NOTE: Swapping on a system is not a good thing for performance but it adds to total virtual memory that a process can access on the system.