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.
#!/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?
I must be missing something because on Opensuse 15.5 hibernation with zramswap works as without it despite no magic happening in the package:
with zswapon reading
When calling
zram-hibernate
the device with the correct ID of the swap drive cannot be found, so maybe something similar to whatzram-hibernate
does is already happening by default?