Increase Swap File for raspberry pi 4 with 1gb RAM

Hi everybody, how can i increase the size of my swap file? It is currently about 250mb and fills up pretty fast. Once it is full, home assistant sometimes crashes. I have a big and fast SD card so i dont mind a swap file of 1 or 2gb.

All the guides on the internet on how to increase swap file do not talk about hassos, so maybe someone here can help me?

Yeah, I have noticed this too on my Raspberry Pi 3 b+, in fact, it regularly fills the swap and that causes very long delays and the load average goes through the roof as the system tries to allocate sdcard space for swap memory… for example, right now:
image

I’m also looking for ways to increase swap.

See if this helps: