Disable SWAP or decrease size of swap file

I am using HAOS (x86-64) on a re-purposed thin client with 16G of RAM and 15G SSD. /mn/data contains a 5G swap file, which, obviously, is not needed and wastes disk space (fills SSD to 100%).

I can log in as root and delete/unmount the swap file to regain space but it is recreated on reboot.

Is there a way to configure the system to disable SWAP? Alternatively, if it cannot be disabled, can it be set to something negligible, say, 32M?

Any thoughts?

According to How to increase the swap file size on Home Assistant OS you might be able to delete it with a script on every boot, but I’d also prefer to have a toggle to disable it permanently.

+1 for this, swap murders SSDs (of any size)

Anyone found how to do this ?

I also want to disable swap on my Raspberry Pi, at the same time I want to enable ZRAM.

To anyone still looking to disable swap, here is a workaround suggested in response to the related issue I submitted on Home Assistant OS (HAOS) – it was closed won't fix:

rm /mnt/data/swapfile; touch /mnt/data/swapfile; chattr +i /mnt/data/swapfile

This is for HAOS and you need to access the base system via ssh on port 22222. It works great! Thank you Katia!

Here is the correct and official way to disable swap in Home assistant OS: Make swap size configurable by sairon · Pull Request #3882 · home-assistant/operating-system · GitHub

Not sure if they added interface yet, but DBus interface worked for me.