I have follow this post to set swap file on my raspberry pi zero and work
Thread
[How to] Enable swapfile on LibreELEC
From @escalade in Remix
By default LibreELEC does not have a swapfile.
You can enable a swapfile by:
cp /etc/swap.conf /storage/.config
then edit it and change
SWAP_ENABLED="no" to SWAP_ENABLED="yes".
SWAPFILESIZE="128" to your required swapfile size - normally 4 x RAM but RAM should be enough for a normal LE system.
When you reboot, a swapfile the size of SWAPFILESIZE is generated in /storage/.config/swapfile.
By default LibreELEC does not have a swapfile.
You can enable a swapfile by:
cp /etc/swap.conf /storage/.config
then edit it and change
SWAP_ENABLED="no" to SWAP_ENABLED="yes".
SWAPFILESIZE="128" to your required swapfile size - normally 4 x RAM but RAM should be enough for a normal LE system.
When you reboot, a swapfile the size of SWAPFILESIZE is generated in /storage/.config/swapfile.
Iridium
however, I have not changed the SWAPFILESIZE="128" at first, then I closed the swap and reboot and then modified SWAPFILESIZE="other" and reboot
the swap file recreated still is 128MB, and I follow this guide(https://linuxhint.com/change_swap_size_ubuntu/) try to modify, but it not work:
swapon -s
swapoff -a
dd if=/dev/zero of=/swapfile bs=1M count=256 (can not use dd, say swapfile readonly)
so, how to change swapfile size?