#HA OS Config Swap option reset

1 messages · Page 1 of 1 (latest)

wooden sky
#

Hello.
I am looking into the swap config option.
We can set the amount of swap via:
"ha os config swap options --swap-size=2G".
I am looking for a way to reset this option to the default "" empty state.
(Which from what I found somewhere sets it automatically to 1/3 of installed RAM which seems to be the case in my quick testing.)

prime citrus
#

Apparently you can't as the CLI doesn't accept -1 or "". How annoying. I consider this a bug and you should report it and link it here.
You can use this to set what HAOS would set. It's a fixed size though

ha os config swap options --swap-size "$(awk '/MemTotal/{ print int($2 * 0.33) }' /proc/meminfo)"

To properly reset get a OS shell like this and run this https://gist.github.com/Impact123/e9a4a07b184eb393d2ff762e3b1b0a05#get-a-os-level-shell

rm /etc/default/haos-swapfile
ha host reboot

Afterwards it should look like this again

# ha os config swap info
swap_size: ""

Reference: https://github.com/home-assistant/operating-system/blob/d42e34f646b632a6426a56d460cbccf403f1d378/buildroot-external/rootfs-overlay/usr/libexec/haos-swapfile#L16-L25