gissf1 / zram-hibernate

Allows dynamic swap changes to activate disk-based storage as swap for hibernation support when a system typically uses only zram swap during normal operation.
Apache License 2.0
34 stars 3 forks source link

hibernate on opensuse 15.5 #5

Open Konfekt opened 9 months ago

Konfekt commented 9 months ago

I must be missing something because on Opensuse 15.5 hibernation with zramswap works as without it despite no magic happening in the package:

# /lib/systemd/system/zramswap.service
#
# Copyright (c) 2012-2018 Malcolm J Lewis <malcolmlewis@opensuse.org>
#

[Unit]
Description=Service enabling compressing RAM with zRam
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/zramswapon
ExecStop=/usr/sbin/zramswapoff
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

with zswapon reading

#!/bin/bash

# get the amount of memory in the machine
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
mem_total=$((mem_total_kb * 1024))

# load the dependency module
modprobe zram

# initialize the device with zstd compression algorithm
echo zstd > /sys/block/zram0/comp_algorithm;
echo $mem_total > /sys/block/zram0/disksize

# Creating the swap filesystem
mkswap /dev/zram0

# Switch the swaps on
swapon -p 100 /dev/zram0

When calling zram-hibernate the device with the correct ID of the swap drive cannot be found, so maybe something similar to what zram-hibernate does is already happening by default?