My Experiments with Oracle

By Sriram Sanka -The AUAA

Posts Tagged ‘swapon’

How to Add Swap Memory using a file

Posted by sriram on December 22, 2018


 

Swap space 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.

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

We can Create Swap file and make use of it as described below .

Step 1: Create a file with required size

To create the file we need to use dd command as root user .

 

I am adding 64G of Swap to my server so the count is 67108864 (1024 * 1024 * 64) 

dd if=/dev/zero of=/u03/extra_swap bs=1024 count=67108864

 

Step 2: Change the file Permission using

chmod 0600 /u03/extra_swap

Step 3 : Set Up linux Swap Area.

[root@idc ~]# mkswap /u03/extra_swap


Step 4 :Execute the Following To enable the swap file immediately, You can Check the Added swap using free -g Command .

swapon /u03/extra_swap


Step 5: Add an Entry in /etc/fstab to Make this Swap file Enabled at boot Time

/u03/extra_swap swap swap defaults 0 0

We can use swapon or /proc/swap to Get the Swap info.




 

 

 

Advertisements

Posted in Linux | Tagged: , , , | Leave a Comment »

 
%d bloggers like this: