- 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.
1 2 3 4 5 6 7 8 9 10 |
fallocate -l 4G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile swapon -s free -m #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