What is SWAP memory?
SWAP memory is basically parts of memory from the RAM (Random Access Memory) that enables an operating system to provide more memory to a running application or process than is available in physical random access memory (RAM). So if the physical memory (RAM) is full, we can use SWAP partition for extra memory resources. It is useful if we have low memory on our machine.
How to increase SWAP size in Raspbian OS
Step 1: Stop the SWAP
sudo dphys-swapfile swapoff
Step 2: Modify the SWAP size
As root
, edit the file /etc/dphys-swapfile
and modify the variable CONF_SWAPSIZE
:
sudo nano /etc/dphys-swapfile
Edit the line and enter decide swap size in MB
CONF_SWAPSIZE=1024
Step 3: Create and initialize the file
Run
sudo dphys-swapfile setup
Step 4: Start the SWAP
sudo dphys-swapfile swapon