Unable to disable swap on virtualized Hass OS

I moved my HassOS installation from an Raspberry Pi to a a virtualized environment. For setup I used the following script https://github.com/tteck/Proxmox/raw/main/vm/haos-vm.sh which pulls the official KVM (qcow2) disk image.

On the RPi I always had problems with RAM, so I dedicated quite a lot diskspace for swapping. As I am now filled with RAM I wanted to disable the swap.

But I have no idea how I could do that… swapoff -a didn’t disabled it, and I see in /procs/swap that a swapfile should live under /mnt/data/swap. I also saw a hassos swap job on boot, but I might to be too stupid to link this information together.

Really appreciate your knowledge.

Just let the operating system operate as it is designed.

You are a long way off using swap (and at 16G allocated ram, it’ll probably never get used_

This is important because swap murders SSDs.

1 Like

it’ll probably never get used_

That’s not how swap works. The OS will use it preemptively even if it isn’t needed. I have a box running proxmox with an SSD in it that was at 15% wearout and had been for months. I ran an HAOS virtual machine on it for 2 weeks with 8GB ram allocated, and after 2 weeks the SSD was at 21% wearout. That’s killing an SSD a year.

The “we know better than you” attitude of this community and HAOS itself is insulting and counterproductive. Feedback like this is important to listen to.

The reported RAM usage was never over 50%, before you go telling me I don’t know what I’m talking about re swap.

swapoff -a
cd /mnt/data
rm swapfile
ln -s /dev/null swapfile

This will turn off swap and prevent it from being reinitialized on boot.

1 Like

This is what I get.


[core-ssh ~]$ swapoff -a
swapoff: /mnt/data/swapfile: Operation not permitted
[core-ssh ~]$

I have 16GB of memory and the RAM is at 40% while I have 80% Swap.

HA TEAM, this is ridiculous. It is murdering our SSDs

I definitely have enough ram to cover the swap usage and then some more.

2 Likes