System Logging and Wearing on Flash

Hello all,

I want to keep the system log from the last 3 boots or so. I have about 4GB of space on the eMMC, so space isnt really an issue.

In /etc/config/system i can set it to save logs to a file. It appears that by default, it will make a new logfile once the current one reaches a certain size.

The more I think about it, the mechanics of making it keep the logs is not really an issue.

What I want is input on is if this amount of writing and moving will wear on the storage and significantly hurt the life span.

I don't know much about hardware and storage so I'm just concerned because I've seen people talking about how there is a very finite amount of writes that memory could do.

Thanks for any insight!

You would be better off having an external syslog server and set the log server in openwrt to that external server address.

This is what i do for my openwrt routers

That's definitely something to consider, but I'm not sure I can do that.

The system I'm making is very custom and more of a travel router sort of deal, so i can't guarantee any network connection to a server on boot.

One thing I was thinking about was streaming the syslog to a server as you suggested if I can see the server. But until I see the server, I would save some amount of them locally and then upload them once a connection was established.

There are filesystems which take that into consideration and prefer to write all over the available space rather than writing/erasing the same space.

is ext4 such a filesystem system?

I'm also concerned about losing data since i expect the system to be turned off by cutting power more often then people actually shutting down /rebooting properly. I figured the journaling or whatever of ext could be good for that. Again, I guess I don't know much about this stuff. I've ticked create a journaling filesystem in build root, but that's about it (I still have 0 percent of reserved blocks in root fs, and don't know if i should bother).

I've read about f2fs as well, but I havent researched it into much yet. So I do not about how it would handle the memory wear or the data integrity. (also dont see an option for it in build root)

Lastly, I know that squashfs is a popular thing, but again, I dont know much about it. It's my understanding that it's readonly, which is a problem if I want to save data about wireless networks and other things that you might need to set.

Thanks for any more input! (as you may be able to see, i'm a bit out of my area)

I am far from expert in this area, so take a second opinion.
I don't think ext4 is ideal for that, f2fs would perform much better in flash like storage.
Regarding the ungraceful restarts/shutdowns the safe choice is read-only root fs with another partition used as storage for the logs. If you are concerned about losing data from the logging partition, then you should send logs to remote syslog.