RunTime in RAM overlay

I use ChaosCalmer15 for different reasons only.
I know, if I install something it is in overlay.
I use it as a VPN server. It is running on RPi from SD card.

Problem is if power fails sometimes SD gets corrupted as server regularly
writes log files and other staff on SD card.

My idea and questiob is if I can have run-time overlay so
everything will be written only in ram. I do not care I do not
have any info. Important is the server runs always. Because I can
hardware lock SD card so it never getd corrupted.

Also I am not sure if openwrt will even start from locked SD as
it will not be possible to mount it rw.

Anynody any hint? I will be grateful for information.
I know latest raspbian has got this possibility but i do not like it
as it has got too much overhead load comparing to excellent openwrt.

If you’ve lost power and had a corrupted DS card this many times, why not get a small ups?

It’s not quite the same, but if you have a disposable USB key you don’t care about, you could use extroot method to preserve your sd card

1 Like

No, I need system which never gets corrupted. I can even permanently lock SD card to make it ROM. UPS can fail as well as usb key.

Well, upto you. Honestly I can’t see why the Ups isn’t a better solution in every way. There’s plenty of blogs and stackoverflow pages of examples to gracefully shutdown if mains power is lost.

For the extroot method, if you unplug the USB key, reboot your device it will not be able to mount the USB key, so will end up running from flash again. You then reflash your USB key from a backup, plug it in and reboot your router again and your fully recovered.

Assuming your router has enough ram to begin with , you might be able to create a fake mount point in ram, then chroot into that using very similar process as the USB key. All I’m saying is keep an open mind.. there’s many ways to tackle the problem .

I have never experimented this, but OpenWrt is designed to run on a read-only "/rom" filesystem, plus a read-write "/overlay" filesystem, and several RAM-based filesystems. Having "/overlay" in RAM seems technically reasonable, then you just need a self-made image.

I still need /overlay to permanently install my software.
But when it runs I want to have /overlay in ram

Is it possible?

That seems a bit contradictory...

Can't you prepare an image with your software already pre-installed? Otherwise, you will need a /rom for the base system, then a /overlay for your modifications, then another overlay in RAM, and I am not sure that is possible.


I was really thinking of this what you suggest.
I think if I can "unpack" system image, then copy overlay files into image and then pack it back should be a solution? Then I can imagine to have an overlay in Ram and it would be excellent!
Do you have idea if it is posible to unpack, copy overlay, redirect overlay to ram and pack back? How is it packed? Thank you for ideas!!

Pack what back?

The router doesn't compile firmware. You'd make a firmware with your packages and settings.

Do you want you settings/packages hard-coded in the firmware...or not?


(You know if this was EXT4, this wouldn't be a problem.)

1 Like

I already found this package, but it seems "zram" disk could be easiest solution. I need to study how it works but so far it looks like that during startup ram-overlay is created in ram. Hopofully all copied from flash-overlay then redirected to ram.
For me this could be solution. Has anybody experience with this?