Once you've done this, we suggest limiting the use of SWAP as using a lot of SWAP affects the Disk I/O, we suggest using the maximum amount of RAM as possible.
Please click here to know how to limit the SWAP usage and maximize the use of RAM.
The following command creates a 512 MB swap file,
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
If you're running low on disk space or need a small swap file, create a 128 MB swap file with the following command,
dd if=/dev/zero of=/swapfile1 bs=1024 count=131072
or a 64 MB swap file with the following,
dd if=/dev/zero of=/swapfile1 bs=1024 count=65536
chown root:root /swapfile1 chmod 0600 /swapfile1