File zramswapon of Package systemd-zram-service

#!/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 dependency modules
# Determine module parm
mod_parm=$(modinfo zram |grep parm |tr -s " " |cut -f2 -d ":")
modprobe zram $mod_parm=1

# initialize the devices
echo $((mem_total)) > /sys/block/zram0/disksize

# Creating swap filesystems
mkswap /dev/zram0


# Switch the swaps on
swapon -p 100 /dev/zram0
openSUSE Build Service is sponsored by