Wren Linux

wren-linux / docs / extras / zram.md (as plain text)

Compressed memory (extras/zram.sh)

SYNOPSIS

wrenctl install zram                          turn it on, now and at every boot
wrenctl remove zram                           turn it off
wrenctl manual zram                           print the manual steps below

zramctl                                       how much it holds, and in how little

zram is swap kept in memory, compressed: what hasn't been used for a while is squeezed, which leaves room for everything else. It covers all of this computer, your VMs' memory included, so it is worth having if you run VMs on a laptop short of memory. Nothing goes to disk, and it is gone at power off, unlike a swap file, which can leave passwords and keys on the disk for a while.

LIMITS

MANUAL INSTALL

sudo apt install systemd-zram-generator
printf '%s\n' '[zram0]' 'zram-size = ram / 2' 'compression-algorithm = zstd' |
    sudo tee /etc/systemd/zram-generator.conf
sudo systemctl daemon-reload
sudo systemctl restart systemd-zram-setup@zram0.service
sudo systemctl start dev-zram0.swap
# It is in use if this shows /dev/zram0
swapon --show

To undo:

sudo swapoff /dev/zram0
sudo systemctl stop systemd-zram-setup@zram0.service
sudo rm /etc/systemd/zram-generator.conf
sudo apt-mark auto systemd-zram-generator
sudo systemctl daemon-reload
sudo apt autoremove --purge