--------- SWAP, ZRAM --------- - CHECKING SWAP - LIVE SWAP CHANGES - SWAPPINESS - DISABLING SWAP - SWAP ON ZRAM #======= CHECKING SWAP ================================================= # Used/free memory ~] free -h # List mounted partitions ~] lsblk #======= LIVE SWAP CHANGES ============================================= # disable swap ~] swapoff -a # To set the new value to 10: # make changes as root ~] echo 10 > /proc/sys/vm/swappiness # To turn swap back on: ~] swapon -a #======= SWAPPINESS =================================================== Swappiness is a Linux kernel parameter that controls the relative weight given to swapping out runtime memory. Swappiness represents the percentage of the free memory before activating swap. The lower the value, the less swapping is used and the more memory pages are kept in physical memory. vm.swappiness = 0 Kernel version 3.5 and over: disables swapping. Prior to version 3.5: The kernel will swap only to avoid an out of memory condition. vm.swappiness = 1 Kernel version 3.5 and over: Minimum swappiness without disabling it entirely vm.swappiness = 60 The default value. vm.swappiness = 100 The kernel will swap aggressively. To change swappiness: 1. create/edit file /etc/sysctl.d/99-vmswap.conf ; 2. Insert/edit the line with aproriate value, e.g.: vm.swappiness=10 #======= DISABLING SWAP =============================================== ##======= Non-GPT disks: Simply commenting out the corresponding line in /etc/fstab to prevent swap from mounting on reboot, e.g.: #UUID=dcaa4979-b495-44d2-a117-360b485a35a0 none swap defaults 0 0 ##======= GPT disks: Systemd activates swap partitions based on two different mechanisms. Both are executables in /usr/lib/systemd/system-generators. The generators are run on start-up and create native systemd units for mounts. The first, systemd-fstab-generator, reads the fstab to generate units, including a unit for swap. The second, systemd-gpt-auto-generator inspects the root disk to generate units. It operates on GPT disks only, and can identify swap partitions by their type GUID. To deactivate specific swap space: ~] swapoff /dev/sdxy Alternatively use the -a switch to deactivate all swap space. Since swap is managed by systemd, it will be activated again on the next system startup. To disable the automatic activation of detected swap space permanently, run systemctl --type swap to find the responsible .swap unit and mask it. Check the status: ~] systemctl status *swap or : ~] systemctl --type swap Then disable the service: ~] systemctl mask "dev-*.swap" Does not work for Fedora 36. You shoud delete SWAP partition. ##======= SWAP ON ZRAM ================================================ How can swap on zram be disabled? Immediately: ~] systemctl stop swap-create@zram0 Permanently: ~] touch /etc/systemd/zram-generator.conf or ~] dnf remove zram-generator-defaults ##======= Release Notes A “swap” partition is not created by default at installation time. Instead, a “zram” device is created, and swap enabled on it during start-up. “zram” is a RAM drive that uses compression. See ~] man zram-generator for a brief overview of its function. The “swap-on-zram” feature can be disabled with ~] touch /etc/systemd/zram-generator.conf and reenabled by removing this file, and customized by editing it. See ~] man zram-generator.conf for configuration information, including a description of the default configuration plus ASCII art. ##======= References ================================================== https://forums.fedoraforum.org/showthread.php?319350-Reducing-swappiness https://fedoraproject.org/wiki/Changes/SwapOnZRAM#How_can_it_be_disabled.3F https://unix.stackexchange.com/questions/671940/disabling-swap-on-debian-permanently https://www.mybluelinux.com/how-disable-swap-in-debian-or-linux-system/ https://www.tecmint.com/disable-swap-partition-in-centos-ubuntu/