[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.

  • I'm using LibreELEC in a RPi 3b, and I've learned now about what's swap is!

    So, I will using for sure (since some time my machine freezes [but this is because of some addons that I use ˆˆ])

    What do you recommend for swap size here? I read about 2 x RAM. So If I want this, I'll put SWAPFILESIZE="2000"?

    Thanks for this "How to" :)

  • You can enable a swapfile by:

    cp /etc/swap.conf to /storage/.config

    This did not work (At least not here in RPi). What worked here was just cp /etc/swap.conf /storage/.config

    Edit: Or maybe you are just saying to copy the files, not a command ^^, sorry!

  • I tried this, but looks like the file is protected somehow. My LibreELEC installation is brand new on a RPi3.

    Nano says:

    [ File '/etc/swap.conf' is unwritable ]

  • I tried this, but looks like the file is protected somehow. My LibreELEC installation is brand new on a RPi3.

    Nano says:

    [ File '/etc/swap.conf' is unwritable ]

    You have to edit /storage/.config/swap.conf and not /etc/swap.conf

  • Hi, I created the swap file. And then deleted the file. But my sd card is still smaller in size as much as the swap size chosen, how do I reclaim the space now that swap file is deleted?

  • I used this command to create the swap file, and set the swap size to 2000, which is 2 gigs I suppose

    Code
    cp /etc/swap.conf /storage/.config

    and then merely deleted the swap.conf from .config to disable swap file