Use swapfile on an internel Emmc storage?

Hello everybody,

I made some search on the net and some people don’t recommend using a swapfile on an internal Emmc storage. But to use zram or zswap instead. They said Swapfile can “destroy” internal Emmc storage.

What do you think about it ?


Improvements have lessened the impact using a swap file will have on the lifetime of emmc storage. However, zram and zswap are better alternatives. zram uses part of memory to compress pages. There is a CPU resource usage to do this, but it is much faster than using a page file. zswap is even better; it combines using part of memory to compress pages along with a physical page file. zswap balances use of compression and offloading to disk.

What is best for you depends on what you have and how you use it. On a Pi3B+ with limited memory I still use a swap file with Archlinux, but the swap file gets almost no usage so I don’t worry about killing storage. On a laptop with 8GB memory running Fedora 33 I use zram since there is plenty of memory. On a Pi4 I’m using zswap since 4GB memory isn’t all that much memory and I use a lesser amount of memory for compression balanced with some offloading to SDD storage.

@dbeach: I’ve got a hybrid laptop with 2Gb Ram and the storage is eMMC. I don’t want to kill the eMMC storage because it is in the screen (I’ve got a keyboard who is the base and the screen is the tablet. Together it is a laptop). The screen must be opened if the eMMC is out of order and must be changed by a professional technician. That’s why I don’t want to create a swap partition to avoid the writings. And I don’t know if the swapfile is a good solution in my case. So, I posted this subject.

Note: Manjaro Gnome use 40,5% of my memory when the system is launched and without optimization.

@AlanP: Given the constraints you mention, it seems zram is a good solution for you since it does not use disk storage.

OK, I’ll give it a try. I leave the subject on hold.