Add Swap File to SUSE Linux System

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

Add Swap File to SUSE Linux System

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

Add Swap File to SUSE Linux System

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

Add Swap File to SUSE Linux System

4 – Initialize the swap file with below command

mkswap /var/lib/swap/swapfile

Add Swap File to SUSE Linux System

5 – Now continue with activating the new swap file

swapon /var/lib/swap/swapfile

Add Swap File to SUSE Linux System

6 – Lets check the  swap size status again , we should see the new swap file like below screen

cat /proc/swaps

Add Swap File to SUSE Linux System

7 – Any time we can disable this swap file with following command

swapoff /var/lib/swap/swapfile

Add Swap File to SUSE Linux System

Add Swap File to SUSE Linux System

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.

Add Swap File to SUSE Linux System

9 – After the restart process we should check the status of swap of the system to be sure it has permanent situation.

Add Swap File to SUSE Linux System

 

Leave a Reply


+ five = 10

Blogroll