I want to deploy Linux on user computers in a way state is never preserved between boots (except state saved explicitly by users on external removable devices). System image will be stored on a read-only removable media and possibly network.

All my target computers have SSDs installed. It will be a waste to do not use them, so I am planning to format them as huge swap partitions. Taking advantage of this, because removable media or network is slow compared to SSD disks, I thought it would be a good idea to load (on demand) whole system image on RAM (as tmpfs root file system) and let it take advantage of memory swapping.

Problem is that I can only find complaints about tmpfs and swapping performance. What is so bad with it? How can system fail to decide wich pages keep on ram or on swap? Is tmpfs is treated differently than the rest of the memory? What performance degradation can I expect from this setup?

  • If you're willing to store system images on network, have a look at DRBL project. By using some basic scripting, you can create swap on the fly and use it. With this approach, you don't need to have the swap settings in the image and don't need to worry with different sized SSDs. – Nehal Dattani Sep 11 '17 at 7:55

Associating problems with tmpfs may be selection bias. People running of out memory are more likely to find and report their tmpfs usage.

Anyway, read only root is common in embedded and live distros. One solution is overlayroot, which is a wrapper around overlayfs. The man page and config file has some documentation to get you started. Also see posts like this: Protecting the Root Filesystem on Ubuntu with Overlayroot

Probably not necessary to load an entire disk image into RAM backed storage.

  • It will slow the initial boot, copying the entire thing.
  • Caching already exists, so repeated block reads will be fast.
  • Even with the cache cold, reads from solid state storage will probably be decently fast: tens to hundreds of times lower latency than rotational media (optical or magnetic).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.