Creating a Swap File

These are the steps to add a swap file without messing around with adjusting any partitions (plus it's safer). This will add 1 Gb of swap space.

   dd if=/dev/zero of=/mnt/swapfile bs=1024 count=1048576
   mkswap /mnt/swapfile
   swapon /mnt/swapfile

This quite easy and takes less than a minute to setup. To enable it at boot time, the following must be added to /etc/fstab:

   /mnt/swapfile    swap     swap    defaults  0      0