How to Disable Swap on Raspberry Pi

Having seen how to increase swap on a Raspberry Pi (which, incidentally, works the same way on all Ubuntu, Debian and similar distributions), let’s now look at how to disable it.

There are several ways to disable swap memory; the simplest is to remove it completely from the services loaded at boot, using the following command:

sudo update-rc.d dphys-swapfile remove

Now, to apply the change, simply restart the device with the command:

 sudo reboot now

Many users have found it beneficial to disable it. Personally, I can only say that it depends on the situation and on several factors, such as the read and write speed of your microSD card (given that the Raspberry Pi uses it to store swap).

For some workloads, on the other hand, it is better to increase it as much as possible, to avoid running out of available RAM and to prevent processes from constantly having to rewrite and delete what has been saved.

Enjoy!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top