The catch is, hibernation and zram-as-swap are conceptually incompatible with each other - hibernation requires the system’s memory/state to be written to a swap file/partition in non-volatile memory, so that the system can actually power down. On the other hand, using zram as your swap means that your swap is stored in volatile memory, and thus stops existing once the system powers down.
The file vs. partition thing matters less than the fact that wherever your swap is stored needs to be
Contiguous - you can’t split hibernation data across multiple files/partitions
Big enough to hold your system state - not necessarily equal to your amount of RAM, but that’s the intuitive benchmark
Actually written to disk, so it can be read from when starting back up (“resuming” from hibernation)
Zram might have its uses/value, but AFAIK you’ll have to pick between whatever advantages you’re getting from Zram swap, vs. the ability to use your swap to hibernate.
No, the idea of using zram is to avoid writing to the disk / instead make RAM usage more efficient. The intro paragraph and section 1 here do a pretty good job of explaining how it works:
No problem - I honestly didn’t really understand zram until reading about it recently (ironically, after switching away from Fedora where it was the default), it’s kind of an unintuitive concept!
Briefly, I now have a HP Elitedesk mini PC. I’m doing various ‘experiments’ on it but ultimately it will act as a low power media/NFS server with USB attached storage.
I want to hibernate the PC during the day to save power but bring it back online at night without having to re-mount the USB storage. Yes I could automount the storage via /etc/fstab but I’m plugging/swapping USBs around at the moment.
I went down the zram path because I liked the idea (and also learn about it) of growing the swap if I throw more RAM into the PC and hibernate.
I also want to run some podman containers via Cockpit so your comment about running containers without swap is curious. What’s the issue there please?
I run mini pc’s (4 core 8 and 16GB of ram) here with RKE2 and K3s on MicroOS, they don’t get turned off, they update automatically (since I run Tumbleweed I get a preview of whats coming, so happy to auto update).
To be honest, systems don’t take that long to shutdown and boot up these days either…
But that’s all up to you, I would suggest MicroOS for self maintenance, designed for container workloads etc, but no swap…
@kitman you might want to also look at k3s for containers, I can do everything on my local machine for deployment using helm charts. To investigate it’s use I suggest installing Rancher-Desktop to develop on, there are free courses at the SUSE Rancher Academy as well… https://www.rancher.academy/
There’s an option to daily “power on” at set times. But I found it easier just to edit the logind.conf file and set HandlePowerKey=hibernate - 1 press in the morning hibernates, 1 press in the evening puts it back online.
I looked at k3s some time ago and thought it’s not for me. Plus I prefer podman over docker (why? I don’t know). Podman and VMs under Cockpit is really nice.
But my new learning curve after the silly season will be MicroOS.