Persist vm.swappiness=100 in /etc/sysctl.d/99-zram.conf and delete the unused /swapfile. New NEON-CUSTOMIZATIONS.md covers keyd, USB-C DP modules, HWE-edge kernel, tmpfs /tmp and localepurge, r8152 DKMS history, tailscale, and third-party repos/tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.2 KiB
zram swap on hp-chell (KDE neon)
Set up 2026-03-05, reconstructed on 2026-09-27 from ~/.bash_history
and the live config. It replaces the disk swapfile with compressed swap
in RAM. That suits this machine: 15GiB RAM, and neon's root lives on a
slow external USB/SD card (sda) that you don't want to swap to or wear
out.
Current state (2026-09-27)
$ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 8G 4K 59B 20K [SWAP]
$ swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 8G 0B 100
The zram device is the only swap. zswap is off
(/sys/module/zswap/parameters/enabled = N), and there's nothing
zram-related on the kernel command line.
What was done
-
Installed
zram-tools(Debian's simplezramswapservice; notsystemd-zram-generator, which isn't installed):sudo apt install zram-tools,sudo systemctl enable --now zramswap. -
Configured
/etc/default/zramswap. The file is still the package's own conffile (dpkg -V zram-toolsflags it as modified), with these lines added at the end:ENABLED=true ALGO=zstd SIZE=8192 PRIORITY=100ALGO=zstd: better compression than the defaultlz4, at some CPU cost. Fine on this 4-core Core m7 for swap-sized traffic.SIZE=8192: an 8GiB zram device, a fixed size in MiB.PERCENTisn't set; if set, it would overrideSIZE. That's the uncompressed capacity; actual RAM used is the compressed size (COMPR/TOTALinzramctl).PRIORITY=100: above any disk swap, so zram is used first.
Tuned over several stop/edit/start rounds (the history shows
systemctl stop zramswap/nano/startthree or four times). Only the final values are known. Apply changes withsudo systemctl restart zramswap. -
Disabled the disk swapfile: in
/etc/fstab,# removed swapfile, using zram instead #/swapfile swap swap defaults 0 0then
sudo swapoff /swapfile. -
Raised
vm.swappinessto 100, at runtime only (sudo sysctl vm.swappiness=100). See the loose ends below.
Loose ends (fixed 2026-09-27)
vm.swappiness=100hadn't been made persistent: it had been set withsysctlat runtime only and was back to the default 60. Now persisted in/etc/sysctl.d/99-zram.conf(vm.swappiness=100) and applied live. Swapping to zram is cheap, so a high swappiness is the usual choice. Not changed:vm.page-cluster(still3). Some zram guides set it to0, since zram has no seek cost and readahead just wastes work.- The unused
/swapfile(512MiB, dated 2026-03-04, fstab line commented out) was deleted.
Reapplying on a fresh neon install
sudo apt install zram-tools
sudo tee -a /etc/default/zramswap >/dev/null <<'EOF'
ENABLED=true
ALGO=zstd
SIZE=8192
PRIORITY=100
EOF
sudo systemctl enable --now zramswap
# comment out any /swapfile line in /etc/fstab, then:
sudo swapoff /swapfile
# persist swappiness
echo 'vm.swappiness=100' | sudo tee /etc/sysctl.d/99-zram.conf && sudo sysctl --system
Check with zramctl and swapon --show.