3

My Armbian Bullseye system insists on setting up swap space on /dev/zram0. I don't want it to, as I have created a swap partition that I would prefer to use.

But I can't find how to permanently remove the swap space /dev/zram0. It can be removed temporarily with swapoff but returns on reboot. There is nothing relevant in /etc/fstab or anywhere else that I can find.

Installing zram-tools didn't help as the service failed.

Searching gives lots of pages that say something about swap or zram, but nothing appears to answer this apparently simple question! Any suggestions please?

Added following the answer below: The command

systemctl --type swap

after masking and reboot, shows:

dev-disk-by\x2duuid-1e389607\x2d8cdf\x2d4ce7\x2dacfb\x2dccb7426a336b.swap loaded active active /dev/disk/by-uuid/1e389607-8cdf-4ce7-acfb-ccb7426a336b 

● dev-zram0.swap masked active active /dev/zram0 

The first line is the swap partition. Unfortunately the zram swap has not gone according to swapon --show:

NAME TYPE SIZE USED PRIO 
/dev/sda2 partition 2G 0B -2 
/dev/zram0 partition 995.2M 0B 5
mbrampton
  • 301
  • 3
  • 12

2 Answers2

4

As with so many things, the answer is simple once you have found it! Although it took me quite a while to get there. The critical file has a name specific to Armbian and it needs to be edited:

# sudo vim /etc/default/armbian-zram-config

A few lines down the file, uncomment the line that says SWAP=false:

# Zram swap enabled by default, unless set to disabled
SWAP=false

Reboot, and the zram swap is gone.

mbrampton
  • 301
  • 3
  • 12
1

The /dev/zram0 swap could be managed by systemd, which is why it keeps reappearing on reboot.

Try finding the .swap unit:

systemctl --type swap

Once found, you can mask it:

sudo systemctl mask "dev-XYZ.swap"

Then reboot.

slightly_toasted
  • 732
  • 3
  • 13