How to add swap file with cool pi 4b
-
Swap is a space on a disk that is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space.
Swap space can take the form of either a dedicated swap partition or a swap file. In most cases, when running Linux on a virtual machine, a swap partition is not present, so the only option is to create a swap file.
Example Add 8GB swap memory
sudo dd if=/dev/zero of=/swapfile bs=1M count=8096 sudo chmod 0600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo mount -a or reboot
ubuntu@ubuntu:~$ free -h total used free shared buff/cache available Mem: 3.8Gi 3.2Gi 133Mi 110Mi 458Mi 443Mi Swap: 7.9Gi 1.0Mi 7.9Gi ubuntu@ubuntu:~$
How to adjust the swappiness value