Enabling Swap on RPi4

lazloman

New Member
Jan 22, 2023
11
0
1
I followed these instructions to get swap working in my setup.
https://forum.proxmox.com/threads/how-to-run-pve-7-on-a-raspberry-pi.95658/

As I already had a running setup, I picked up from here:
apt purge dphys-swapfile -y

Everything went fine, but after the reboot, I ran this command:


sudo zpool create sdpool /dev/sda3

But got this error:
The ZFS modules are not loaded. Try running '/sbin/modprobe zfs' as root to load them.

And no, the modprobe command does not work, so I'm dead in the water here. Any have any ideas?
Thanks
 
Whatever you are running cannot be (called) Proxmox VE because that requires an 64-bit x86 processor.
Putting swap on ZFS is (unfortunately) not recommended, and that's why the Proxmox installer does not setup swap on ZFS.
It looks like you are not using ZFS (since the ZFS modules are not loaded), so why are you trying to put swap on ZFS (which is not recommended)?
Maybe ask the person who made the software that you are running? Or just search for a guide to add swap to a Linux system: https://duckduckgo.com/?t=lm&q=linux+swap
 
The instructions on how to do this come from this very forum. They are specifically for the RPi. I'm not sure where you're coming from.
Okay lets start right away with the first bit, what you need: [B]- Raspberry Pi ( 4B recommended )[/B] - SD Card ( USB-SSD recommended ) - Ethernet connection - RPi-OS-64bit ( [URL='https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2021-05-28/2021-05-07-raspios-buster-arm64-lite.zip']https://downloads.raspberrypi.org/r...5-28/2021-05-07-raspios-buster-arm64-lite.zip[/URL] ) - knowledge how to flash this Image (Win: RasPiImager, balenaetcher, Win32DiskImager Linux: dd)... - knowledge how to connect to your RPi via ssh. - around 30min - 2h ( depending on the RPi type, clock, disk and network speed )
 
Hi lazloman,

I'm not sure where you're coming from.

I suppose he thinks of this banner on top of the page you link to,
Disclaimer:

!!! This is NOT meant for production use and is NOT official supported !!!


Which is most unfortunate, of course.

The fact that someone posts a message on this forum, does not mean that it is about software made (and supported) by Proxmox. In this case, the APT repository gives away that it is not proxmox.com:

# Pimox7 Repo deb https://raw.githubusercontent.com/pimox/pimox7/master/ dev/

Even so, great that people take the source and run with it to enable wider usage.

As @leesteken suggested, why would you run
sudo zpool create sdpool /dev/sda3
when you want to add swap?

I ran into the need for a swapfile earlier. If your PI boots, try:

fallocate -l 512M /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile
 
Last edited:
Does anyone know how to get swap working under PiMox?
I'll give you a hint- its the same as setting up swap on ANY DEBIAN INSTALL. https://wiki.debian.org/Swap

you may need to give it a bit more planning though, since swap is very IO intensive. What disk devices do you have attached to the system, with what file systems? You really dont want to enable swap on an sdcard, as an example.
 
No, I don't want to use the card. I have an USB drive connected to the RPi. I wanted to use that for swap, using whichever file stem makes sense.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!