I've got an NVMe SSD attached (via USB 3 port) to my Raspberry Pi and wonder what's the best (and still relatively easy) way to configure it for memory demanding applications (like Geth), assuming Raspberry Pi OS Lite or maybe also Ubuntu (Server) for Raspberry Pi.

I've read quite a lot about zram and zswap (and zcache which seems to be not available/recommended anymore) and about SSDs being bad for swap (wear) vs. that this is not true anymore for modern SSDs. It's too overwhelming and too difficult for me to decide which statements are still valid and which apply to the Raspberry Pi at all.

What do you recommend, based on your (recent) experience? Preferably with step-by-step instructions/commands how to get there :-)

I read that Armbian uses zram with vm.swappiness=100, but I find their configuration script quite intimidating. I'm sure there's a simpler way to "just activate zram" (in a recommended way for the Raspberry Pi). I guess their script is more complex because they support many ARM-based devices and probably also tried to get the optimal performance. I'm happy with something below the optimum if it makes the configuration way simpler in return. I prefer simple commands/steps that makes me feel I change the OS configuration in a quite common/standard way ;-)

I also read an article about zswap where it seems very easy to activate that (just edit /etc/default/grub). But I assume this is intended to be used with the normal swap file, which is 100 MiB by default on Raspberry Pi OS, so I guess I'd better increase that as well and especially move the swap file to the SSD. From what I've found these would be the steps for that (as root):

  1. dphys-swapfile swapoff
  2. Modify CONF_SWAPSIZE and CONF_SWAPFILE in /etc/dphys-swapfile
  3. dphys-swapfile setup
  4. dphys-swapfile swapon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.