Raspberry Pi | how to disable swapping

If you wan’t to disable swapping on your raspberry pi to prevent fast weardown of you SD card or even if you are using a SSD to boot on via USB it can reduce your disks lifespan if you have swapping turned on and it’s default on.

Here is how to completely disable swapping on Raspberry Pi (raspberian)

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove
apt purge dphys-swapfile

This is tested on my Raspberry Pi 3 with Raspberian 9 (Debian 9 based)

WARNING: this is only a good idea if you know that the server has enough ram for it’s tasks.