- Swap file on! Only when you need it…
- Create a permanent swap file equal to RAM bytes
So here’s a quick snippet to turn on swap on a file, even after OS installation, temporarily. At line one notice the file size is
4G . Modify it to your needs.
If you uncomment the last line, is about to make it permanent.
fallocate -l 4G /swapfile
chmod 600 /swapfile
#if you prefer, make it permanent
#echo "/swapfile none swap sw 0 0" >> /etc/fstab
OR if your’re a lazy like me use this script