Add SWAP on box #179
araczkowski
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Normally(after system installation on eMMC) the SWAP memory is not configured on box, so when your programs use more memory then DDR memory on box then LMK (low memory killer) is run and the program is killed.

To be able to run more programs and not be killed by system when memory is low you need to add SWAP memory - allocate memory on disc.
For this you should do (as root):
Create a file that will serve as swap memory
fallocate -l 8G /swapfile8G means 8 gigabytes. You can adjust this value, for example, to 2G for 2 GB.
Set the correct permissions
chmod 600 /swapfileConfigure the file as swap
mkswap /swapfileActivate the swap file
swapon /swapfileCheck your swap memory
free -hcp /etc/fstab /etc/fstab.baknano /etc/fstabAdd the following line to the end of the file:
/swapfile none swap sw 0 0Now after reboot you will have your swap 🎉
And when your programs will eat more memory then your DDR on box then the SWAP will be used instead of LMK
Beta Was this translation helpful? Give feedback.
All reactions