Make a Swapfile


(Jonathan Dumont) #1

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


(Artem Fedai) #2

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 !


(Jonathan Dumont) #3

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.