Configuring systemd-swap different results

I followed this guide https://wiki.manjaro.org/index.php?title=Swap#Automated_Swap_Management_with_systemd-swap
My output is:-

swapon
NAME                           TYPE SIZE USED PRIO
/var/lib/systemd-swap/swapfc/1 file 512M   0B   50

It is supposed to be:-

NAME                           TYPE SIZE USED PRIO
/var/lib/systemd-swap/swapfc/1 file 512M   0B   -2

The PRIO is 50 and output should be PRIO -2
I don’t know where I went wrong? The system is now less responsive that before installing systemd-swap.
free -m

               total        used        free      shared  buff/cache   available
Mem:           15471        1638       12129         158        1703       13392
Swap:            511           0         511

AFAIK swap priority only matters if you have multiple swap devices and a reason to prefer some of them to others. If you have a single swap device, it won’t make any difference.

Use swapon -p but you can check more options consulting swapon --help
Also, do not forget about swappiness
Also, also

for swap is nowhere to be ok.
Personally i prefer zram-generator so when i run swapon i get some like this (depending what i do and what applications have opened):

NAME       TYPE       SIZE USED PRIO
/dev/zram0 partition 11,7G 1,1G  100

Systemd Swap dynamically allocates SWAP file size, the SWAP size changes depending on the need. I think 512M is when it starts.

PS: I removed it a month or so ago as it wasn’t working anymore [Testing Update] 2023-03-11 - Kernels, Mesa 22.3.7, Phosh, LibreOffice 7.4.6 - #52 by omano

1 Like

Thanks every one @omano said Systemd Swap not working and @bogdancovaciu suggestedd zram-generator.
How do I remove systemd-swap and install zram-generator.

pamac remove systemd-swap

pamac install zram-generator

Then just to be sure, check this zram - ArchWiki

Ok

pamac remove systemd-swap

pamac install zram-generator

$# cat > /etc/systemd/zram-generator.conf
[zram0]
zram-size = ram
compression-algorithm = zstd
Then reboot and
free -h
total used free shared buff/cache available
Mem: 15Gi 1.7Gi 12Gi 97Mi 1.1Gi 13Gi
Swap: 15Gi 0B 15Gi

swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 15.1G 0B 100

Thanks @bogdancovaciu for the start and pointing me in the right direction.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.