<div dir="ltr"><div>Hi, was my email not coming through?</div><div><br></div><div>Regards.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 12, 2023 at 12:06 PM Renjaya Raga Zenta <<a href="mailto:renjaya.zenta@formulatrix.com">renjaya.zenta@formulatrix.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
We have custom embedded device using SD Card as the main storage.<br>
I think there are some concerns regarding how journald write the<br>
logs, that may cause massive write amplification and that's bad for<br>
a standard SD Card.<br>
<br>
Journald has Storage= option, I could use Storage=volatile and<br>
ForwardToSyslog=yes then the disk writes seems acceptable. I could still do<br>
systemctl status and journalctl, but the logs won't be available the<br>
next reboot.<br>
<br>
Journalctl has --flush command, to flush any log data stored in<br>
/run/log/journal/ into /var/log/journal/. It also has --relinquish-var<br>
command, to do the reverse operation of --flush.<br>
<br>
Correct me if I'm wrong, if I do journalctl --flush, journald will write<br>
in bulk, isn't it? So the write amplification has less effect. If it's<br>
true, then I think periodically switching journald storage may help.<br>
<br>
1. First, I set Storage=volatile<br>
2. After a while, I change it to Storage=persistent or Storage=auto,<br>
then journalctl --flush (is restarting systemd-journald necessary?)<br>
3. Then, I change it again to Storage=volatile and journalctl<br>
--relinquish-var (again, is restarting systemd-journald required?).<br>
<br>
So, is this a good approach? Or is my assumption is wrong. Please kindly<br>
advise.<br>
<br>
If it isn't wrong, the next question is when should I switch from /run to<br>
/var? The /run is using tmpfs, so it's in memory. I need to do the<br>
switch before the journal log size in /run up to 50 MB for example. How<br>
to do that?<br>
<br>
<br>
Thank you.<br>
<br>
</blockquote></div></div>