Make a Swapfile

If your like me and you installed your NethServer into a little DigitalOcean droplet’s.
Soon or later you’ll need to make a swapfile.

###This is how I did it as root over SSH
Verify the status of memory / swap
# free -m

Make the SWAPfile

dd if=/dev/zero of=/swapfile bs=1M count=1024
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s

Verify the status of memory / swap

free -m

Make it permanent

Add this line into /etc/fstab
swapfile none swap sw 0 0

Tweak your SWAP

 sysctl vm.swappiness=10
 sysctl vm.vfs_cache_pressure=50

Make those tweak permanent

Add those 2lines at the bottom of /etc/sysctl.conf

vm.swappiness=10
vm.vfs_cache_pressure=50

inspiration : https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

As you may know on Virtual machines there’s no need to make swap at all! Better to increase memory, coz SWAP make overload of DISK system !

In the pass, I had a problem of receiving email on a Debian server.
Postfix did’nt have enough RAM to queuing email.
Since that time, I always make a swap, just in case.

cool notes.

If a smaller memory has been made, and one needs to increase the value to say 2048 instead of 1024, how should one go about it.