:: What is swap in linux
Swap in linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.
:: How to create swap file in Linux
+ Create file (1GB) for add swap
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
+ Make swap file
mkswap /swapfile
+ Change owner and permission
chown root.root /swapfile chmod 0600 /swapfile
+ Enable swap file
swapon /swapfile
+ Checking
free -m
+ configure /etc/fstab to save configuration permanently
vi /etc/fstab # add swap file configuration like this: /swapfile swap swap defaults 0 0