Increase swap partition size

A section of a computer's hard disk or SSD that the operating system (OS) uses to store inactive data from Random Access Memory (RAM) called SWAP Memory or SWAP Space.

Normally yocto need 32 GB RAM, so if your system has less RAM then you can use SWAP Memory insted.

Follow steps to increase SWAP Memory.

first check whether you have already swap partation and its size

grep Swap /proc/meminfo

check ram size

free -h

if your swap+ram size is less then 32 GB then create a swap partation of size = (32 - ramsize)

to create 1 GB swap partation

sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1M
sudo chmod 0600 /swapfile
sudo mkswap /swapfile 

sudo swapon /swapfile  # Turn the swap on

If you want to make a 4 GiB file, then change count value to count=4M

make it parmenent

vim /etc/fstab

# Add this line to the end
/swapfile swap swap sw 0 0

©2023-2024 rculock.com