If you want to add new “Swap Space” to your SUSE linux system then you can follow the below steps to do it easily..
1 – First of all we should check the current size of the swap file before starting the process
cat /proc/swaps
2 – Now we should create an empty file in our system , so we are going to create a new directory as “swap“
mkdir -p /var/lib/swap
3 – Second process should be creating a new file as “swapfile” with 128 MB file size.
dd if=/dev/zero of=/var/lib/swap/swapfile bs=1M count=128
4 – Initialize the swap file with below command
mkswap /var/lib/swap/swapfile
5 – Now continue with activating the new swap file
swapon /var/lib/swap/swapfile
6 – Lets check the swap size status again , we should see the new swap file like below screen
cat /proc/swaps
7 – Any time we can disable this swap file with following command
swapoff /var/lib/swap/swapfile
8 – If we want to get this swap file as permenant then we have to add below line to “/etv/fstab” file otherwise this swap defination will be only temporary till next system reboot.
9 – After the restart process we should check the status of swap of the system to be sure it has permanent situation.