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

1 Answer 1


Never had the need to increase swap yet but have some experience with ssd's.

If you install raspbian on the ssd, then your commands in the post should be ok to increase swap.

Just be aware that NVME's are not very good with raspberry pi. They consume too much power. Your usb ports combined can provide only 1.2A and thats ~6 watts. And on Samsung's website: 970 EVO Plus 2TB: Average 6.0 W

My rpi4 was crashing using a samsung 970 evo plus and a samsung T5 at the same time. Moved to a sata ssd and no problems, can use both 870 evo and T5 together.

  • Yes, I had problems with power consumption (disk outages), I could solve them using an external, active USB hub. I was not aware that this is a general issue with NVMe's, so thanks for mentioning that.
    – msa
    Jun 16, 2023 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.