archlinux

21 - Swap

Previous: Install bootloader

References:


Let us configure swap in ram with zram.

First, disable zswap by setting a kernel parameter. Execute

nano /boot/EFI/limine/limine.conf

Add the zswap.enabled=0 to the list of kernel parameters:

timeout: 10

/Arch Linux (linux)
    protocol: linux
    path: boot():/vmlinuz-linux
    cmdline: cryptdevice=/dev/sda2:root root=/dev/mapper/root zswap.enabled=0 rootflags=subvol=@ rw rootfstype=btrfs
    module_path: boot():/initramfs-linux.img

/Arch Linux (linux-fallback)
    protocol: linux
    path: boot():/vmlinuz-linux
    cmdline: cryptdevice=/dev/sda2:root root=/dev/mapper/root zswap.enabled=0 rootflags=subvol=@ rw rootfstype=btrfs
    module_path: boot():/initramfs-linux-fallback.img

Install

pacman -S zram-generator

Create a config file with

nano /etc/systemd/zram-generator.conf

Add

[zram0]

The unit systemd-zram-setup@zram0.service will be automatically loaded.

After reboot, check status with

systemctl status systemd-zram-setup@zram0.service

or

zramctl

or

swapon --show

Next: Configure initramfs