Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

God requireth not a uniformity of religion. -- Roger Williams


computers / comp.sys.raspberry-pi / Re: move /var/log to a RAMDISK

SubjectAuthor
* move /var/log to a RAMDISKThe Natural Philosopher
+* Re: move /var/log to a RAMDISKDavid W. Hodgins
|+* Re: move /var/log to a RAMDISKThe Natural Philosopher
||`* Re: move /var/log to a RAMDISKDavid W. Hodgins
|| `* Re: move /var/log to a RAMDISKdruck
||  +* Re: move /var/log to a RAMDISKThe Natural Philosopher
||  |+- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
||  |`* Re: move /var/log to a RAMDISKdruck
||  | `* Re: move /var/log to a RAMDISKThe Natural Philosopher
||  |  `* Re: move /var/log to a RAMDISKdruck
||  |   `- Re: move /var/log to a RAMDISKThe Natural Philosopher
||  +* Re: move /var/log to a RAMDISKJohn-Paul Stewart
||  |`- Re: move /var/log to a RAMDISKThe Natural Philosopher
||  `- Re: move /var/log to a RAMDISKBob Latham
|+* Re: move /var/log to a RAMDISKTheo
||`* Re: move /var/log to a RAMDISKThe Natural Philosopher
|| +* Re: move /var/log to a RAMDISKRich
|| |`* Re: move /var/log to a RAMDISKThe Natural Philosopher
|| | `- Re: move /var/log to a RAMDISKRichard Kettlewell
|| +- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|| +- Re: move /var/log to a RAMDISKJohn-Paul Stewart
|| `* Re: move /var/log to a RAMDISKDavid W. Hodgins
||  `- Re: move /var/log to a RAMDISKThe Natural Philosopher
|`* Re: move /var/log to a RAMDISK23k.302
| `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|  `* Re: move /var/log to a RAMDISK23k.304
|   `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|    +- Re: move /var/log to a RAMDISK23k.304
|    `* Re: move /var/log to a RAMDISKJan Panteltje
|     +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |+- Re: move /var/log to a RAMDISK23k.304
|     |`* Re: move /var/log to a RAMDISK23k.304
|     | `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |  `* Re: move /var/log to a RAMDISK23k.304
|     |   +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |   |`* Re: move /var/log to a RAMDISK23k.304
|     |   | `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |   |  +* Re: move /var/log to a RAMDISKJan Panteltje
|     |   |  |`* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |   |  | `* Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|     |   |  |  `* Re: move /var/log to a RAMDISK23k.304
|     |   |  |   `- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|     |   |  `* Re: move /var/log to a RAMDISK23k.304
|     |   |   +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|     |   |   |`- Re: move /var/log to a RAMDISK23k.304
|     |   |   `- Re: move /var/log to a RAMDISKRobert Riches
|     |   `- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|     `* Re: move /var/log to a RAMDISK23k.304
|      +- Re: move /var/log to a RAMDISKJan Panteltje
|      `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|       +- Re: move /var/log to a RAMDISKThe Natural Philosopher
|       +- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|       `* Re: move /var/log to a RAMDISK23k.304
|        +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |`* Re: move /var/log to a RAMDISK23k.304
|        | `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |  +- Re: move /var/log to a RAMDISK23k.304
|        |  `* Re: move /var/log to a RAMDISK23k.304
|        |   +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |   |+* Re: move /var/log to a RAMDISKRich
|        |   ||`* Re: move /var/log to a RAMDISK23k.304
|        |   || `* Re: move /var/log to a RAMDISKRich
|        |   ||  `- Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |   |+* Re: move /var/log to a RAMDISK23k.304
|        |   ||`- Re: move /var/log to a RAMDISKRich
|        |   |`* Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|        |   | +* Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |   | |`* Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|        |   | | `* Re: move /var/log to a RAMDISKThe Natural Philosopher
|        |   | |  +- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|        |   | |  `- Re: move /var/log to a RAMDISKRich
|        |   | `- Re: move /var/log to a RAMDISKRich
|        |   `- Re: move /var/log to a RAMDISKTauno Voipio
|        `* Re: move /var/log to a RAMDISKJan Panteltje
|         `* Re: move /var/log to a RAMDISK23k.304
|          `* Re: move /var/log to a RAMDISKDennis Lee Bieber
|           `- Re: move /var/log to a RAMDISK23k.304
+* Re: move /var/log to a RAMDISKRobert Heller
|+* Re: move /var/log to a RAMDISKThe Natural Philosopher
||+* Re: move /var/log to a RAMDISKRobert Heller
|||+* Re: move /var/log to a RAMDISKComputer Nerd Kev
||||`* Re: move /var/log to a RAMDISKDavid W. Hodgins
|||| `* Re: move /var/log to a RAMDISKThe Natural Philosopher
||||  `* Re: move /var/log to a RAMDISKComputer Nerd Kev
||||   +* Re: move /var/log to a RAMDISKCarlos E.R.
||||   |`* Re: move /var/log to a RAMDISKDavid W. Hodgins
||||   | `- Re: move /var/log to a RAMDISKThe Natural Philosopher
||||   `* Re: move /var/log to a RAMDISKThe Natural Philosopher
||||    `* Re: move /var/log to a RAMDISKRich
||||     `* Re: move /var/log to a RAMDISKRobert Heller
||||      `* Re: move /var/log to a RAMDISKThe Natural Philosopher
||||       `* Re: move /var/log to a RAMDISKRobert Heller
||||        `* Re: move /var/log to a RAMDISKThe Natural Philosopher
||||         `* Re: move /var/log to a RAMDISKDave
||||          +* Re: move /var/log to a RAMDISKAhem A Rivet's Shot
||||          |`- Re: move /var/log to a RAMDISKThe Natural Philosopher
||||          +- Re: move /var/log to a RAMDISKDennis Lee Bieber
||||          `- Re: move /var/log to a RAMDISKThe Natural Philosopher
|||+- Re: move /var/log to a RAMDISKAhem A Rivet's Shot
|||`- Re: move /var/log to a RAMDISKThe Natural Philosopher
||`- Re: move /var/log to a RAMDISKDavid W. Hodgins
|`* Re: move /var/log to a RAMDISKPancho
+- Re: move /var/log to a RAMDISKDavid Taylor
`* Re: move /var/log to a RAMDISKmm0fmf

Pages:123456789
move /var/log to a RAMDISK

<ua3ijl$2m0am$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6634&group=comp.sys.raspberry-pi#6634

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 18:34:45 +0100
Organization: A little, after lunch
Lines: 24
Message-ID: <ua3ijl$2m0am$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 29 Jul 2023 17:34:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ceb4a33e3ce2bbadc429607c8d317811";
logging-data="2818390"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Oc9knLbw/92A6PpF3YSEDVDxLCDxkqHQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:Z3JtN3NDDYJOWL82F8ZGESv7I/E=
Content-Language: en-GB
 by: The Natural Philosop - Sat, 29 Jul 2023 17:34 UTC

Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
logs for debugging and why wear the SD card?

My question is simple. If I make a 50MByte or so RAMDISK and mount it on
/var/log, will the logging daemons recreate all the files and
directories they need at boot time?

I am barely using any memory on a headless server - there is room for a
ramdisk

# free -m
total used free shared buff/cache
available
Mem: 429 61 131 3 237
310
Swap: 99 0 99

--
The theory of Communism may be summed up in one sentence: Abolish all
private property.

Karl Marx

Re: move /var/log to a RAMDISK

<op.18uwwysca3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6639&group=comp.sys.raspberry-pi#6639

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 14:42:24 -0400
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <op.18uwwysca3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e9f9fef4a1ac24d24f260eb1038d0955";
logging-data="2831786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SZQATdUEw3wv6vmXOGokMFVDT9gXe1/s="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:S+/X4ELD+FrvCi9c1m7nWFQ+NuQ=
 by: David W. Hodgins - Sat, 29 Jul 2023 18:42 UTC

On Sat, 29 Jul 2023 13:34:45 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
> Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
> logs for debugging and why wear the SD card?

> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
> /var/log, will the logging daemons recreate all the files and
> directories they need at boot time?

No. Files in /var are expected to survive reboot, so that's how the packages
are configured.

They are created during package installation. For example,
$ rpm -q -l postgresql13-server|grep /var/log
/var/log/postgres

Looking at the spec file for the rpm package, it has ...
%attr(700,postgres,postgres) %dir /var/log/postgres
which is used by rpm to set the ownership and permissions.

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6640&group=comp.sys.raspberry-pi#6640

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.22.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 29 Jul 2023 18:45:20 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: move /var/log to a RAMDISK
In-Reply-To: <ua3ijl$2m0am$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Content-Type: text/plain; charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
Date: Sat, 29 Jul 2023 18:45:21 +0000
Lines: 34
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-JgWfCWCP74DFZMvs3uCjc20Y04kzedkVkTvn+SfMNOf9DZ6KY822O1z/Rfg25fK+9HcPMJ89Lw5prFk!79fxuje+VzVxijYoLmTDklvDFYqSUorzyushtMn2V8A7T7Trs0Shux3HNH7w4kbGDhIqO6uuD8Uw!oeg=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 2584
 by: Robert Heller - Sat, 29 Jul 2023 18:45 UTC

This is in fact the default behaviour for Armbian on my Banana Pi M64.

If you want, I can send you the scripts used. They create the RAMDISK, copy
the existing files on boot, then copy back during shutdown (so the log files
are not lost).

At Sat, 29 Jul 2023 18:34:45 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote:

>
> Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
> logs for debugging and why wear the SD card?
>
> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
> /var/log, will the logging daemons recreate all the files and
> directories they need at boot time?
>
>
> I am barely using any memory on a headless server - there is room for a
> ramdisk
>
> # free -m
> total used free shared buff/cache
> available
> Mem: 429 61 131 3 237
> 310
> Swap: 99 0 99
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: move /var/log to a RAMDISK

<ua3n91$2mbh0$2@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6642&group=comp.sys.raspberry-pi#6642

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 19:54:25 +0100
Organization: A little, after lunch
Lines: 29
Message-ID: <ua3n91$2mbh0$2@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 29 Jul 2023 18:54:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ceb4a33e3ce2bbadc429607c8d317811";
logging-data="2829856"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/x5QuQbUu+xiUy40MeRTNODlNbQkPwd+E="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:L4imMZLvTO5S6k8E24SZrZxIPLM=
In-Reply-To: <op.18uwwysca3w0dxdave@hodgins.homeip.net>
Content-Language: en-GB
 by: The Natural Philosop - Sat, 29 Jul 2023 18:54 UTC

On 29/07/2023 19:42, David W. Hodgins wrote:
> On Sat, 29 Jul 2023 13:34:45 -0400, The Natural Philosopher
> <tnp@invalid.invalid> wrote:
>> Embedded Raspberry Pi Zero W. Minimal logs generated but  I only use
>> logs for debugging and why wear the  SD card?
>
>> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
>> /var/log, will the logging daemons recreate all the files and
>> directories they need at boot time?
>
> No. Files in /var are expected to survive reboot, so that's how the
> packages
> are configured.
>
> They are created during package installation. For example,
> $ rpm -q -l postgresql13-server|grep /var/log
> /var/log/postgres
>
> Looking at the spec file for the rpm package, it has ...
> %attr(700,postgres,postgres) %dir /var/log/postgres
> which is used by rpm to set the ownership and permissions.
>
> Regards, Dave Hodgins
I feared that might be the case.
--
"Nature does not give up the winter because people dislike the cold."

― Confucius

Re: move /var/log to a RAMDISK

<ua3q2k$2mksr$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6643&group=comp.sys.raspberry-pi#6643

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 20:42:12 +0100
Organization: A little, after lunch
Lines: 40
Message-ID: <ua3q2k$2mksr$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 29 Jul 2023 19:42:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ceb4a33e3ce2bbadc429607c8d317811";
logging-data="2839451"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ovb4DGzDD1uFooTtjNCYRkZ6wnNvi2ms="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:eT3Zep82UWQ96DWKZh5i6tdAEuE=
In-Reply-To: <o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
Content-Language: en-GB
 by: The Natural Philosop - Sat, 29 Jul 2023 19:42 UTC

On 29/07/2023 19:45, Robert Heller wrote:
> This is in fact the default behaviour for Armbian on my Banana Pi M64.
>
> If you want, I can send you the scripts used. They create the RAMDISK, copy
> the existing files on boot, then copy back during shutdown (so the log files
> are not lost).
>
I can write that ok myself.
However there would be no *controlled shutdown*. We are talking power cuts.
The actual application does not write to SD disk at all, except for
persistent configuration. Runtime files use a ram disk.

So the aim is to limit random writes that might happend when power is
pulled from under.
In use the only likely things would be systemd which logs everything
all the time, and apache.
Exim might send a mail a month.

Looking at the log files there is a huge amount of installation stuff
that simply isn't needed, and stuff that appears at boot time that
doesn't need to be preserved on power loss.

So I guess this is really a more general discussion about how to reduce
logging to a minimum, and reduce writing to persistent storage to a
minimum as well

I can set apache to log to a volatile storage area OK I think.
And probably Exim too - mount ramdisks on /var/log/apache2 and
/var/log/exim4

The problem is that the whole*nix logging system is based on how a good
minicomputer sysadmin would like things, not how an embedded linux
running off an SD card needs to be :-)

--
"Nature does not give up the winter because people dislike the cold."

― Confucius

Re: move /var/log to a RAMDISK

<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6644&group=comp.sys.raspberry-pi#6644

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 29 Jul 2023 20:35:49 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: move /var/log to a RAMDISK
In-Reply-To: <ua3q2k$2mksr$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>?
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>
Date: Sat, 29 Jul 2023 20:35:49 +0000
Lines: 59
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-2lNbWcULet2Eq9C3zahiAaZb8s/Wyn6vDxpe68wjJMs+0bPPvdTtoMHiRRwzsXpY/l7Z6kXKp8CUMJu!R+KZVWzq8k1ZvgEZsN4t/M6PiUHe5vVnfRqCbtkxIIjuSKOcVuFUnqIjSVr5aIqkPaKf3MA6pyEx!WzM=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Sat, 29 Jul 2023 20:35 UTC

At Sat, 29 Jul 2023 20:42:12 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote:

>
> On 29/07/2023 19:45, Robert Heller wrote:
> > This is in fact the default behaviour for Armbian on my Banana Pi M64.
> >
> > If you want, I can send you the scripts used. They create the RAMDISK, copy
> > the existing files on boot, then copy back during shutdown (so the log files
> > are not lost).
> >
> I can write that ok myself.
> However there would be no *controlled shutdown*. We are talking power cuts.
> The actual application does not write to SD disk at all, except for
> persistent configuration. Runtime files use a ram disk.
>
> So the aim is to limit random writes that might happend when power is
> pulled from under.
> In use the only likely things would be systemd which logs everything
> all the time, and apache.
> Exim might send a mail a month.
>
> Looking at the log files there is a huge amount of installation stuff
> that simply isn't needed, and stuff that appears at boot time that
> doesn't need to be preserved on power loss.
>
> So I guess this is really a more general discussion about how to reduce
> logging to a minimum, and reduce writing to persistent storage to a
> minimum as well

Embeded servers (eg OpenWRT) mount /var from a ramdisk at boot, and likely
initially populate it that file system from some "static" initial state (with
all of the basic directory tree elements) at boot time. And then on
reboot/power failure, all of that is just lost (discarded). (Most
OpenWRT-based servers have the option of remote logging, if one wants
persistent logs.)

DRBL (Diskless Remote Boot Linux), also does this. It mounts the root (/) and
/usr file systems read-only from the server and create RAMDISK file systems
for /etc /var and /root (~root) and populates these FSs from pre-generated
tarballs and rsyncs host specific content from a template tree at boot time
and then discards them on shutdown.

>
> I can set apache to log to a volatile storage area OK I think.
> And probably Exim too - mount ramdisks on /var/log/apache2 and
> /var/log/exim4
>
> The problem is that the whole*nix logging system is based on how a good
> minicomputer sysadmin would like things, not how an embedded linux
> running off an SD card needs to be :-)
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: move /var/log to a RAMDISK

<op.18u06wxua3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6645&group=comp.sys.raspberry-pi#6645

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 16:14:46 -0400
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <op.18u06wxua3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net> <ua3n91$2mbh0$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e9f9fef4a1ac24d24f260eb1038d0955";
logging-data="2861381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18drC3P4mEf8p/Fbxys0CKmIYoHecqLs0E="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:4pb93mS8uxmA7/7lL1s1djlmSKA=
 by: David W. Hodgins - Sat, 29 Jul 2023 20:14 UTC

On Sat, 29 Jul 2023 14:54:25 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:

> On 29/07/2023 19:42, David W. Hodgins wrote:
>> On Sat, 29 Jul 2023 13:34:45 -0400, The Natural Philosopher
>> <tnp@invalid.invalid> wrote:
>>> Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
>>> logs for debugging and why wear the SD card?
>>
>>> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
>>> /var/log, will the logging daemons recreate all the files and
>>> directories they need at boot time?
>>
>> No. Files in /var are expected to survive reboot, so that's how the
>> packages
>> are configured.
>>
>> They are created during package installation. For example,
>> $ rpm -q -l postgresql13-server|grep /var/log
>> /var/log/postgres
>>
>> Looking at the spec file for the rpm package, it has ...
>> %attr(700,postgres,postgres) %dir /var/log/postgres
>> which is used by rpm to set the ownership and permissions.

> I feared that might be the case.

It can be done using scripts that hook into systemd, but is not easy, and may
require changes to scripts with any package install that uses /var/log, and
also risks losing parts of the logs in the case of an unclean shutdown, which
is typically when you are going to want the logs.

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<op.18u4e3ena3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6646&group=comp.sys.raspberry-pi#6646

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 17:24:29 -0400
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <op.18u4e3ena3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com> <ua3q2k$2mksr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e9f9fef4a1ac24d24f260eb1038d0955";
logging-data="2861381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zeSM2bRNFAfMJBZEjeEwosnFtwDHwcUw="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:uaUVhEw5NOol9/ZgQbHejHeY10I=
 by: David W. Hodgins - Sat, 29 Jul 2023 21:24 UTC

On Sat, 29 Jul 2023 15:42:12 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
> The problem is that the whole*nix logging system is based on how a good
> minicomputer sysadmin would like things, not how an embedded linux
> running off an SD card needs to be :-)

That's not a nix thing. Live iso images work fine with no permanent storage,
though most have an option to have persistent storage too.

While running a general purpose linux distribution installed on an sd card does
work, they are not tailored for use on embedded systems.

An embedded system should be designed to work like a live iso, but with essential
data stored on persistent storage, and with only the minimum needed applications,
and system tools.

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<64c5ad35@news.ausics.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6647&group=comp.sys.raspberry-pi#6647

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Message-ID: <64c5ad35@news.ausics.net>
From: not...@telling.you.invalid (Computer Nerd Kev)
Subject: Re: move /var/log to a RAMDISK
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
References: <ua3ijl$2m0am$1@dont-email.me> <o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com> <ua3q2k$2mksr$1@dont-email.me> <ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/2.4.31 (i586))
NNTP-Posting-Host: news.ausics.net
Date: 30 Jul 2023 10:22:13 +1000
Organization: Ausics - https://www.ausics.net
Lines: 41
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: Computer Nerd Kev - Sun, 30 Jul 2023 00:22 UTC

In comp.os.linux.misc Robert Heller <heller@deepsoft.com> wrote:
> At Sat, 29 Jul 2023 20:42:12 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote:
>> Looking at the log files there is a huge amount of installation stuff
>> that simply isn't needed, and stuff that appears at boot time that
>> doesn't need to be preserved on power loss.
>>
>> So I guess this is really a more general discussion about how to reduce
>> logging to a minimum, and reduce writing to persistent storage to a
>> minimum as well
>
> Embeded servers (eg OpenWRT) mount /var from a ramdisk at boot, and likely
> initially populate it that file system from some "static" initial state (with
> all of the basic directory tree elements) at boot time. And then on
> reboot/power failure, all of that is just lost (discarded). (Most
> OpenWRT-based servers have the option of remote logging, if one wants
> persistent logs.)
>
> DRBL (Diskless Remote Boot Linux), also does this. It mounts the root (/) and
> /usr file systems read-only from the server and create RAMDISK file systems
> for /etc /var and /root (~root) and populates these FSs from pre-generated
> tarballs and rsyncs host specific content from a template tree at boot time
> and then discards them on shutdown.

Yes a few distros are designed similar to that. The server computer
on my home LAN (which also runs off an SD card) is set to only save
/var/lib/hwclock between reboots. If you don't run a syslog daemon
then logs from programs that send them to syslog don't go anywhere.
Busybox comes with a syslogd implementation which can be started to
show all log info in the terminal with "busybox syslogd -n -O -".
So run that during development for debugging, then when it's all
working, go syslog-free.

On a system that isn't designed for temporary /var, if you just
recreate empty directories in /var (those listed by
"find /var -type d") after reboot, I expect all the programs that
are already installed will create fresh files inside those
directories by themselves.

--
__ __
#_ < |\| |< _#

Re: move /var/log to a RAMDISK

<op.18vk8skaa3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6649&group=comp.sys.raspberry-pi#6649

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sat, 29 Jul 2023 23:27:54 -0400
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <op.18vk8skaa3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com> <ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="0f1437b19ee208557a3fb008e47282b4";
logging-data="3033618"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iY3z7FhLQp6d7ASDQGmbG/+TUtFyOmK8="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:rzeysjEHT7AZIQRvyON9RnndNKo=
 by: David W. Hodgins - Sun, 30 Jul 2023 03:27 UTC

On Sat, 29 Jul 2023 20:22:13 -0400, Computer Nerd Kev <not@telling.you.invalid> w
> On a system that isn't designed for temporary /var, if you just
> recreate empty directories in /var (those listed by
> "find /var -type d") after reboot, I expect all the programs that
> are already installed will create fresh files inside those
> directories by themselves.

The owner, group, and permissions must be set correctly too.

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<20230730052740.f614fbceef26475c8218fc97@eircom.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6650&group=comp.sys.raspberry-pi#6650

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ste...@eircom.net (Ahem A Rivet's Shot)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 05:27:40 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <20230730052740.f614fbceef26475c8218fc97@eircom.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a3490fa4254a349e6d3294e34aba1056";
logging-data="3036225"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sY3Xs8HAbZQxoHFvniDwp1FqUds83UkQ="
Cancel-Lock: sha1:9iDBJxVL1qBpAEZExvP2MpN1Mcw=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.1)
X-Clacks-Overhead: "GNU Terry Pratchett"
 by: Ahem A Rivet's - Sun, 30 Jul 2023 04:27 UTC

On Sat, 29 Jul 2023 20:35:49 +0000
Robert Heller <heller@deepsoft.com> wrote:

> Embeded servers (eg OpenWRT) mount /var from a ramdisk at boot, and
> likely initially populate it that file system from some "static" initial
> state (with all of the basic directory tree elements) at boot time.

Another common technique is to overlay a ramdisk on a read-only
file system so that the ram disk only holds the changes.

--
Steve O'Hara-Smith
Odds and Ends at http://www.sohara.org/
Host: Beautiful Theory meet Inconvenient Fact
Obit: Beautiful Theory died today of factual inconsistency

Re: move /var/log to a RAMDISK

<ua4u6d$2surr$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6652&group=comp.sys.raspberry-pi#6652

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 06:58:37 +0100
Organization: A little, after lunch
Lines: 14
Message-ID: <ua4u6d$2surr$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 30 Jul 2023 05:58:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b69f6069b5264b6bb02f98551d65f27f";
logging-data="3046267"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JoqBQEx9nWESQsCsHX74Li+bk/hYi1/E="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:JN3bXQDNVlonIckAuYbt68id7UU=
Content-Language: en-GB
In-Reply-To: <ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com>
 by: The Natural Philosop - Sun, 30 Jul 2023 05:58 UTC

On 29/07/2023 21:35, Robert Heller wrote:
> Embeded servers (eg OpenWRT) mount /var from a ramdisk at boot, and likely
> initially populate it that file system from some "static" initial state (with
> all of the basic directory tree elements) at boot time. And then on
> reboot/power failure, all of that is just lost (discarded).

That is an thought. Dont rely on fstab, but run a script.
Really its only /var/log I care about. Rest of var can do as it pleases
- its so little used ro write to.

--
Climate Change: Socialism wearing a lab coat.

Re: move /var/log to a RAMDISK

<ua50i0$2t42v$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6654&group=comp.sys.raspberry-pi#6654

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 07:38:56 +0100
Organization: A little, after lunch
Lines: 32
Message-ID: <ua50i0$2t42v$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net>
<op.18vk8skaa3w0dxdave@hodgins.homeip.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 30 Jul 2023 06:38:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b69f6069b5264b6bb02f98551d65f27f";
logging-data="3051615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xJ3fMWSMVAkdB5hWhE0cUf6I+uxQCl2U="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:/KL3mhxtV27SIGwzRsdcgNgC9H8=
Content-Language: en-GB
In-Reply-To: <op.18vk8skaa3w0dxdave@hodgins.homeip.net>
 by: The Natural Philosop - Sun, 30 Jul 2023 06:38 UTC

On 30/07/2023 04:27, David W. Hodgins wrote:
> On Sat, 29 Jul 2023 20:22:13 -0400, Computer Nerd Kev
> <not@telling.you.invalid> w
>> On a system that isn't designed for temporary /var, if you just
>> recreate empty directories in /var (those listed by
>> "find /var -type d") after reboot, I expect all the programs that
>> are already installed will create fresh files inside those
>> directories by themselves.
>
> The owner, group, and permissions must be set correctly too.
>
> Regards, Dave Hodgins

Well you would just copy /var/log to somewhere on persistent, delete all
the files and then do a cp - R on reboot. Except that the first thing
that happens on boot is the daemons fill up /var/log with boot messages :-(

I note since its Sunday, that the newest log files have been created by
the logrotate process and are all empty.

Ah well. The smallest SD card I could easily get was 16GB, and RasPios
and friends have only used 1.5GB.

It will probably take a long time to wear out.

--
“The fundamental cause of the trouble in the modern world today is that
the stupid are cocksure while the intelligent are full of doubt."

- Bertrand Russell

Re: move /var/log to a RAMDISK

<64c6183e@news.ausics.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6655&group=comp.sys.raspberry-pi#6655

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Message-ID: <64c6183e@news.ausics.net>
From: not...@telling.you.invalid (Computer Nerd Kev)
Subject: Re: move /var/log to a RAMDISK
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
References: <ua3ijl$2m0am$1@dont-email.me> <o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com> <ua3q2k$2mksr$1@dont-email.me> <ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net> <op.18vk8skaa3w0dxdave@hodgins.homeip.net> <ua50i0$2t42v$1@dont-email.me>
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/2.4.31 (i686))
NNTP-Posting-Host: news.ausics.net
Date: 30 Jul 2023 17:58:54 +1000
Organization: Ausics - https://www.ausics.net
Lines: 36
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: Computer Nerd Kev - Sun, 30 Jul 2023 07:58 UTC

In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote:
> On 30/07/2023 04:27, David W. Hodgins wrote:
>> On Sat, 29 Jul 2023 20:22:13 -0400, Computer Nerd Kev
>> <not@telling.you.invalid> wrote:
>>> On a system that isn't designed for temporary /var, if you just
>>> recreate empty directories in /var (those listed by
>>> "find /var -type d") after reboot, I expect all the programs that
>>> are already installed will create fresh files inside those
>>> directories by themselves.
>>
>> The owner, group, and permissions must be set correctly too.
>
> Well you would just copy /var/log to somewhere on persistent, delete all
> the files and then do a cp - R on reboot. Except that the first thing
> that happens on boot is the daemons fill up /var/log with boot messages :-(

This is of course not really the first thing that happens on boot,
so if you can get in before the init system starts daemons then
that solves your problem. I wouldn't like to try figuring out how
to do that with something like Systemd, but then I avoid that sort
of thing anyway. Busybox has a simple init system, good for
embedded systems.

> Ah well. The smallest SD card I could easily get was 16GB, and RasPios
> and friends have only used 1.5GB.
>
> It will probably take a long time to wear out.

I was curious about this once too - does a 16GB SD card where only
1.5GB is used last longer than say a 2GB card? I couldn't find a
conclusive answer online, except that an SD card's unlikely to be
near as smart about wear levelling as an SSD is.

--
__ __
#_ < |\| |< _#

Re: move /var/log to a RAMDISK

<I9j*tSymz@news.chiark.greenend.org.uk>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6656&group=comp.sys.raspberry-pi#6656

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!.POSTED.chiark.greenend.org.uk!not-for-mail
From: theom+n...@chiark.greenend.org.uk (Theo)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: 30 Jul 2023 10:24:30 +0100 (BST)
Organization: University of Cambridge, England
Message-ID: <I9j*tSymz@news.chiark.greenend.org.uk>
References: <ua3ijl$2m0am$1@dont-email.me> <op.18uwwysca3w0dxdave@hodgins.homeip.net>
Injection-Info: chiark.greenend.org.uk; posting-host="chiark.greenend.org.uk:212.13.197.229";
logging-data="17477"; mail-complaints-to="abuse@chiark.greenend.org.uk"
User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (Linux/5.10.0-22-amd64 (x86_64))
Originator: theom@chiark.greenend.org.uk ([212.13.197.229])
 by: Theo - Sun, 30 Jul 2023 09:24 UTC

In comp.sys.raspberry-pi David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
> On Sat, 29 Jul 2023 13:34:45 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
> > Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
> > logs for debugging and why wear the SD card?
>
> > My question is simple. If I make a 50MByte or so RAMDISK and mount it on
> > /var/log, will the logging daemons recreate all the files and
> > directories they need at boot time?
>
> No. Files in /var are expected to survive reboot, so that's how the packages
> are configured.
>
> They are created during package installation. For example,
> $ rpm -q -l postgresql13-server|grep /var/log
> /var/log/postgres
>
> Looking at the spec file for the rpm package, it has ...
> %attr(700,postgres,postgres) %dir /var/log/postgres
> which is used by rpm to set the ownership and permissions.

The directory structure may be created by the package manager on install,
but the files are created on the fly. In other words I might have
/var/log/foo/error.log - foo is a directory that needs to exist, but if I
delete error.log it'll be created next time there's something to go in
there. This is commonly used by 'logrotate', which moves old files and
compresses them, allowing new files to be created for future log entries.

So all you really need to do is reproduce the directory structure:

find /var/log -type d -exec mkdir -p "/tmp/{}" \;

which reproduces /var/log/foo/bar/ to /tmp/var/log/foo/bar/

Theo

Re: move /var/log to a RAMDISK

<ua5t32$2v7cu$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6658&group=comp.sys.raspberry-pi#6658

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 15:45:54 +0100
Organization: A little, after lunch
Lines: 51
Message-ID: <ua5t32$2v7cu$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
<I9j*tSymz@news.chiark.greenend.org.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 30 Jul 2023 14:45:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b69f6069b5264b6bb02f98551d65f27f";
logging-data="3120542"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lV4uEcjC13QFo2RJdLRoA9xzQopGFEAg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:+lrFLsUQv1oZsKOVFdOLTMOtYFw=
In-Reply-To: <I9j*tSymz@news.chiark.greenend.org.uk>
Content-Language: en-GB
 by: The Natural Philosop - Sun, 30 Jul 2023 14:45 UTC

On 30/07/2023 10:24, Theo wrote:
> In comp.sys.raspberry-pi David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
>> On Sat, 29 Jul 2023 13:34:45 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
>>> Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
>>> logs for debugging and why wear the SD card?
>>
>>> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
>>> /var/log, will the logging daemons recreate all the files and
>>> directories they need at boot time?
>>
>> No. Files in /var are expected to survive reboot, so that's how the packages
>> are configured.
>>
>> They are created during package installation. For example,
>> $ rpm -q -l postgresql13-server|grep /var/log
>> /var/log/postgres
>>
>> Looking at the spec file for the rpm package, it has ...
>> %attr(700,postgres,postgres) %dir /var/log/postgres
>> which is used by rpm to set the ownership and permissions.
>
> The directory structure may be created by the package manager on install,
> but the files are created on the fly. In other words I might have
> /var/log/foo/error.log - foo is a directory that needs to exist, but if I
> delete error.log it'll be created next time there's something to go in
> there. This is commonly used by 'logrotate', which moves old files and
> compresses them, allowing new files to be created for future log entries.
>
> So all you really need to do is reproduce the directory structure:
>
> find /var/log -type d -exec mkdir -p "/tmp/{}" \;
>
> which reproduces /var/log/foo/bar/ to /tmp/var/log/foo/bar/
>
> Theo
Now that is interesting, and if I leave the old /var/log there, and
mount a ramdisk over it, provided that the ramdisk is *immediately*
populated and directories created, then all should work?

I guess I have to learn how to add a script to systemd :-(

--
“People believe certain stories because everyone important tells them,
and people tell those stories because everyone important believes them.
Indeed, when a conventional wisdom is at its fullest strength, one’s
agreement with that conventional wisdom becomes almost a litmus test of
one’s suitability to be taken seriously.”

Paul Krugman

Re: move /var/log to a RAMDISK

<ua5vcd$2ve9t$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6659&group=comp.sys.raspberry-pi#6659

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 15:25:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <ua5vcd$2ve9t$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me> <op.18uwwysca3w0dxdave@hodgins.homeip.net> <I9j*tSymz@news.chiark.greenend.org.uk> <ua5t32$2v7cu$1@dont-email.me>
Injection-Date: Sun, 30 Jul 2023 15:25:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="647b8bd691fa237b1530080a6209b3c4";
logging-data="3127613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Pmdn3WKAMehNVhNOMFW8Q"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:Sosl2I9h6zCxRA65u6OEgwr2UKI=
 by: Rich - Sun, 30 Jul 2023 15:25 UTC

In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote:
> On 30/07/2023 10:24, Theo wrote:
>> The directory structure may be created by the package manager on
>> install, but the files are created on the fly. In other words I
>> might have /var/log/foo/error.log - foo is a directory that needs to
>> exist, but if I delete error.log it'll be created next time there's
>> something to go in there. This is commonly used by 'logrotate',
>> which moves old files and compresses them, allowing new files to be
>> created for future log entries.
>>
>> So all you really need to do is reproduce the directory structure:
>>
>> find /var/log -type d -exec mkdir -p "/tmp/{}" \;
>>
>> which reproduces /var/log/foo/bar/ to /tmp/var/log/foo/bar/
>>
>> Theo
>
> Now that is interesting, and if I leave the old /var/log there, and
> mount a ramdisk over it, provided that the ramdisk is *immediately*
> populated and directories created, then all should work?

You /may/ need to trigger the logging deamon to redo the files. With
traditional syslog that would be send the log deamon's a sighub. With
systemd I have no idea how to do this as none of my linux systems
contain systemd.

> I guess I have to learn how to add a script to systemd :-(

True. Hopefully there is a way.

Re: move /var/log to a RAMDISK

<20230730162342.fb1ab62e46142a1362640a90@eircom.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6660&group=comp.sys.raspberry-pi#6660

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ste...@eircom.net (Ahem A Rivet's Shot)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 16:23:42 +0100
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <20230730162342.fb1ab62e46142a1362640a90@eircom.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
<I9j*tSymz@news.chiark.greenend.org.uk>
<ua5t32$2v7cu$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a3490fa4254a349e6d3294e34aba1056";
logging-data="3129156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196j6YeTw/GUDL07gY8dWQTGT3uK7sN1Jo="
Cancel-Lock: sha1:Vo4X9a2dzjwrVIE8cdWdWOdPDx8=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.1)
X-Clacks-Overhead: "GNU Terry Pratchett"
 by: Ahem A Rivet's - Sun, 30 Jul 2023 15:23 UTC

On Sun, 30 Jul 2023 15:45:54 +0100
The Natural Philosopher <tnp@invalid.invalid> wrote:

> Now that is interesting, and if I leave the old /var/log there, and
> mount a ramdisk over it, provided that the ramdisk is *immediately*
> populated and directories created, then all should work?
>
> I guess I have to learn how to add a script to systemd :-(

You might like this approach it layers a ramdisc over an existing
filesystem.

https://unix.stackexchange.com/questions/339496/mounting-var-as-overlayfs

--
Steve O'Hara-Smith
Odds and Ends at http://www.sohara.org/
Host: Beautiful Theory meet Inconvenient Fact
Obit: Beautiful Theory died today of factual inconsistency

Re: move /var/log to a RAMDISK

<kine7aFlvp9U1@mid.individual.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6661&group=comp.sys.raspberry-pi#6661

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: jpstew...@personalprojects.net (John-Paul Stewart)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 11:34:02 -0400
Lines: 22
Message-ID: <kine7aFlvp9U1@mid.individual.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
<I9j*tSymz@news.chiark.greenend.org.uk> <ua5t32$2v7cu$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net mj+qHXOKigDASt9xEAs6DAYOIRYXl2eX5ktU/3qcg+A1aFnGrI
Cancel-Lock: sha1:ZzQSDNI0IeArtFfZAL6GgNWbxno= sha256:NOKXQvgw/D00VsgjQ5fyZ4eIUzXACBc0hJ/W7qQiLGo=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Content-Language: en-CA
In-Reply-To: <ua5t32$2v7cu$1@dont-email.me>
 by: John-Paul Stewart - Sun, 30 Jul 2023 15:34 UTC

On 7/30/23 10:45, The Natural Philosopher wrote:
> On 30/07/2023 10:24, Theo wrote:
>> So all you really need to do is reproduce the directory structure:
>>
>> find /var/log -type d -exec mkdir -p "/tmp/{}" \;
>>
>> which reproduces /var/log/foo/bar/ to /tmp/var/log/foo/bar/
>>
>> Theo
> Now that is interesting, and if I leave the old /var/log there, and
> mount a ramdisk over it, provided that the ramdisk is *immediately*
> populated and directories created, then all should work?

Any process that has a log file open before you mount the ramdisk won't
automatically start using it. The process will still have the open file
handle to the original, disk-based file instead. So you'll either need
to be sure to mount the ramdisk sufficiently early in the boot sequence
to ensure that no daemons have opened their logfiles yet, or you'll need
to signal those daemons reopen their logs. Most do that in response to
SIGHUP. Logrotate often uses that mechanism after rotating logs, so its
configuration can help you figure out what needs to be done after
mounting the ramdisk if programs are still logging to disk.

Re: move /var/log to a RAMDISK

<op.18wlxnlea3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6662&group=comp.sys.raspberry-pi#6662

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 12:40:25 -0400
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <op.18wlxnlea3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
<I9j*tSymz@news.chiark.greenend.org.uk> <ua5t32$2v7cu$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="0f1437b19ee208557a3fb008e47282b4";
logging-data="3140440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o+DXNGKXnWro0vc2P/0jkLhM1gyZbcW0="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:KmnmVlPdoHVtoB8rgnoB3fsxIGI=
 by: David W. Hodgins - Sun, 30 Jul 2023 16:40 UTC

On Sun, 30 Jul 2023 10:45:54 -0400, The Natural Philosopher <tnp@invalid.invalid> wrote:
> Now that is interesting, and if I leave the old /var/log there, and
> mount a ramdisk over it, provided that the ramdisk is *immediately*
> populated and directories created, then all should work?
>
> I guess I have to learn how to add a script to systemd :-(

I would add an entry to fstab to handle the mount ...
mylog /var/log tmpfs defaults,user,size=1G 1 1

Copy the directory structure from /var/log somewhere else such as /my/log.

copy /usr/lib/systemd/system/systemd-remount-fs.service to /etc/systemd/system/,
(create the dir if it doesn't exist already), then modify the /etc service to
add a second ExecStart to run a script that copies the directory structure from
/my log to /var/log.

Run "dracut -f" and reboot.

If you later install something that creates a directory in /var/log, just create
a directory with that name, owner, group, and permissions in /my/log.

Make a backup on a second sd card first though, just in case! :-)

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<ucuipjxuj9.ln2@Telcontar.valinor>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6663&group=comp.sys.raspberry-pi#6663

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: robin_li...@es.invalid (Carlos E.R.)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 22:39:26 +0200
Lines: 55
Message-ID: <ucuipjxuj9.ln2@Telcontar.valinor>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net>
<op.18vk8skaa3w0dxdave@hodgins.homeip.net> <ua50i0$2t42v$1@dont-email.me>
<64c6183e@news.ausics.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net DoHYoecaVLaFPuUhJDDPAQziJPAjRCdQ06jFXDdeFXjdjuAkQw
X-Orig-Path: Telcontar.valinor!not-for-mail
Cancel-Lock: sha1:vOsHrJwPAZF4GFO1ylWsLaIz+n8= sha256:a65InQZM68gW1uy498vcSTi8GFjvNqijQ46/w8sRW6U=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Content-Language: es-ES, en-CA
In-Reply-To: <64c6183e@news.ausics.net>
 by: Carlos E.R. - Sun, 30 Jul 2023 20:39 UTC

On 2023-07-30 09:58, Computer Nerd Kev wrote:
> In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote:
>> On 30/07/2023 04:27, David W. Hodgins wrote:
>>> On Sat, 29 Jul 2023 20:22:13 -0400, Computer Nerd Kev
>>> <not@telling.you.invalid> wrote:
>>>> On a system that isn't designed for temporary /var, if you just
>>>> recreate empty directories in /var (those listed by
>>>> "find /var -type d") after reboot, I expect all the programs that
>>>> are already installed will create fresh files inside those
>>>> directories by themselves.
>>>
>>> The owner, group, and permissions must be set correctly too.
>>
>> Well you would just copy /var/log to somewhere on persistent, delete all
>> the files and then do a cp - R on reboot. Except that the first thing
>> that happens on boot is the daemons fill up /var/log with boot messages :-(
>
> This is of course not really the first thing that happens on boot,
> so if you can get in before the init system starts daemons then
> that solves your problem. I wouldn't like to try figuring out how
> to do that with something like Systemd, but then I avoid that sort
> of thing anyway.

On my desktop machine, using openSUSE Leap, the service
"bootmsg.service" initializes some the logs. Writes "var/log/boot.msg",
for instance.

Syslog and or journal are services, so you can create the files before
any of those two services run. For instance, I have my own
"boot-marker.service" which writes a timestamp to /var/log/messages:

[Unit]
Description=Write boot markers in /var/log/messages
Before=syslog.service

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/root/ThingsNeededForBoot/write-boot-marker start
ExecStop=-/root/ThingsNeededForBoot/write-boot-marker stop

[Install]
WantedBy=multi-user.target

A systemd system might not have syslog, but journal, and non permanent
(not on disk). It may use temporary files, though.

--
Cheers, Carlos.

Re: move /var/log to a RAMDISK

<op.18wyj1ila3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6664&group=comp.sys.raspberry-pi#6664

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Sun, 30 Jul 2023 17:13:03 -0400
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <op.18wyj1ila3w0dxdave@hodgins.homeip.net>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com> <ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net>
<op.18vk8skaa3w0dxdave@hodgins.homeip.net> <ua50i0$2t42v$1@dont-email.me>
<64c6183e@news.ausics.net> <ucuipjxuj9.ln2@Telcontar.valinor>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="0f1437b19ee208557a3fb008e47282b4";
logging-data="3182337"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+R6y2y9puEmuxFYOXT4Wcua+p7+XgolTI="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:BssFT4Baeb5b19sKhSkXfqbWNHE=
 by: David W. Hodgins - Sun, 30 Jul 2023 21:13 UTC

On Sun, 30 Jul 2023 16:39:26 -0400, Carlos E.R. <robin_listas@es.invalid> wrote:
> A systemd system might not have syslog, but journal, and non permanent
> (not on disk). It may use temporary files, though.

With systemd, systemd-journald collects messages during early boot, in ram. The
in ram copy is flushed to persistent storage shortly after the / filesystem is
remounted rw over the ro / filesystem from the initrd.

That's why I recommend adding an extra ExecStart to systemd-remount-fs.service
to set up the directory structure in a tmpfs mount of /var/log right after
the / filesystem is ready to accept writes. That way it's done before the
journal or, if present, rsyslogd starts writing to /var/log.

Regards, Dave Hodgins

Re: move /var/log to a RAMDISK

<sLKcnQERn8HAiVr5nZ2dnZfqnPudnZ2d@earthlink.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6665&group=comp.sys.raspberry-pi#6665

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 31 Jul 2023 01:54:37 +0000
Subject: Re: move /var/log to a RAMDISK
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
References: <ua3ijl$2m0am$1@dont-email.me>
<op.18uwwysca3w0dxdave@hodgins.homeip.net>
From: 23k...@bfxw9.net (23k.302)
Organization: toroid nitrogen
Date: Sun, 30 Jul 2023 21:54:36 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <op.18uwwysca3w0dxdave@hodgins.homeip.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <sLKcnQERn8HAiVr5nZ2dnZfqnPudnZ2d@earthlink.com>
Lines: 43
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 68.222.41.156
X-Trace: sv3-WRKdOgE0zMkQjDBN0jRn6JJGfWzE2SnNOCQ3q85o3TpW2KOWNSdfDe7gaCynMXguSsP+YvAKN9oiJab!i7C2WOO6yJfJo9DpqNJDBF4PqsYki1N9KgAySmI4iaJpFYd5aXl6aYYv/miueh6mwFEldwdYplgm!CwNq6m3H3Q3c3EixS8Bl
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: 23k.302 - Mon, 31 Jul 2023 01:54 UTC

On 7/29/23 2:42 PM, David W. Hodgins wrote:
> On 7/30/23 10:45, The Natural Philosopher wrote:
>> On 30/07/2023 10:24, Theo wrote:
>>> So all you really need to do is reproduce the directory structure:
>>>
>>> find/var/log -type d -exec mkdir -p "/tmp/{}" \;
>>>
>>> which reproduces/var/log/foo/bar/ to/tmp/var/log/foo/bar/
>>>
>>> Theo
>> Now that is interesting, and if I leave the old /var/log there, and
>> mount a ramdisk over it, provided that the ramdisk is*immediately*
>> populated and directories created, then all should work?
> Any process that has a log file open before you mount the ramdisk won't
> automatically start using it. The process will still have the open file
> handle to the original, disk-based file instead. So you'll either need
> to be sure to mount the ramdisk sufficiently early in the boot sequence
> to ensure that no daemons have opened their logfiles yet, or you'll need
> to signal those daemons reopen their logs. Most do that in response to
> SIGHUP. Logrotate often uses that mechanism after rotating logs, so its
> configuration can help you figure out what needs to be done after
> mounting the ramdisk if programs are still logging to disk.

Hmm ... MIGHT be able to make that work with minimal
pain using systemd. It has 'depends on','run after' and
such params. He could init the ramdisk REALLY early in a
quasi-structured/quasi-safe environment.

Not everyone likes systemd - but it DOES have its uses.

Another trick is to just make the ramdisk whenever and
then make /var/log into a symlink/mountpoint. Yes, there'd
be some early stuff still in the real /var/log, but maybe
that's not important for him.

However I'd rec ramdisks for where they're more useful.
I have an app that does a lot of image manipulation
before the results are shown via PHP/Apache on a Pi.
I don't want any of that to be reading/writing to the
SD card - too slow AND burns it out - but I did want
access to be "normal", like with any 'real' drive. A
small ramdisk was by far the best/easiest solution.

Re: move /var/log to a RAMDISK

<ua7lad$36l4h$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6666&group=comp.sys.raspberry-pi#6666

 copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david-ta...@blueyonder.co.uk.invalid (David Taylor)
Newsgroups: comp.sys.raspberry-pi
Subject: Re: move /var/log to a RAMDISK
Date: Mon, 31 Jul 2023 07:45:33 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ua7lad$36l4h$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
Reply-To: david-taylor@blueyonder.co.uk
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 31 Jul 2023 06:45:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a784d1abe73da112d2e4e1be4be43584";
logging-data="3363985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19a5h8DTgh1g6lsHON71/Y+acZGG5/0nwg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:g0FMSCPwLpih4XPMlKbwGbqACQE=
Content-Language: en-GB
In-Reply-To: <ua3ijl$2m0am$1@dont-email.me>
 by: David Taylor - Mon, 31 Jul 2023 06:45 UTC

On 29/07/2023 18:34, The Natural Philosopher wrote:
> Embedded Raspberry Pi Zero W. Minimal logs generated but I only use
> logs for debugging and why wear the SD card?
>
> My question is simple. If I make a 50MByte or so RAMDISK and mount it on
> /var/log, will the logging daemons recreate all the files and
> directories they need at boot time?

Would this be of any interest?

https://github.com/openenergymonitor/emonpi/blob/master/rpi-ro

--
Cheers,
David
Web: https://www.satsignal.eu

Re: move /var/log to a RAMDISK

<ua7t2i$382l6$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=6667&group=comp.sys.raspberry-pi#6667

 copy link   Newsgroups: comp.sys.raspberry-pi comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi,comp.os.linux.misc
Subject: Re: move /var/log to a RAMDISK
Date: Mon, 31 Jul 2023 09:57:54 +0100
Organization: A little, after lunch
Lines: 48
Message-ID: <ua7t2i$382l6$1@dont-email.me>
References: <ua3ijl$2m0am$1@dont-email.me>
<o5adnUGa5uLcw1j5nZ2dnZfqn_ednZ2d@giganews.com>
<ua3q2k$2mksr$1@dont-email.me>
<ev-cnSZfJ8u45Vj5nZ2dnZfqnPSdnZ2d@giganews.com> <64c5ad35@news.ausics.net>
<op.18vk8skaa3w0dxdave@hodgins.homeip.net> <ua50i0$2t42v$1@dont-email.me>
<64c6183e@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jul 2023 08:57:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="50f3be7459467def83cb6e971d9bafad";
logging-data="3410598"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LzTRadY7QeTw70qpHtJBSV1KeABsn1k8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:YofTc1l8aNykSJi0BZr5v2pSjKE=
In-Reply-To: <64c6183e@news.ausics.net>
Content-Language: en-GB
 by: The Natural Philosop - Mon, 31 Jul 2023 08:57 UTC

On 30/07/2023 08:58, Computer Nerd Kev wrote:
>> Ah well. The smallest SD card I could easily get was 16GB, and RasPios
>> and friends have only used 1.5GB.
>>
>> It will probably take a long time to wear out.
> I was curious about this once too - does a 16GB SD card where only
> 1.5GB is used last longer than say a 2GB card? I couldn't find a
> conclusive answer online, except that an SD card's unlikely to be
> near as smart about wear levelling as an SSD is.

I think that SD cards (apart from a very few) have no sophisticated wear
levelling *at all*.

From what I could find out they never map *already written* sectors to
new ones so the old sectors get their allocation of writes, too.

My guess is that they would probably *at best* allocate new blocks to
writes till they ran out.

Then sequentially reuse all the already used but 'erased' blocks. That
sort of behaviour would work well for e.g. camera SD cards which get
full but no so often

So, the more blocks the merrier.

If they are *really* cheap they wont do anything at all and there will
be a 1:1 correlation between physical and logical sectors, in which case
it doesn't matter how big they are, they will wear out the directory and
sector allocation sectors without ever using the majority of the card.

I am not sure if e.g. linux can map out bad sectors in those areas. I
suspect not.

My other Pi zero has been on for about 3 years now, writing the log
files. and rotating them. It doesn't do a lot - its simple allows me to
access and play my recorded music and the radio to one of the home hi fis.

--
“People believe certain stories because everyone important tells them,
and people tell those stories because everyone important believes them.
Indeed, when a conventional wisdom is at its fullest strength, one’s
agreement with that conventional wisdom becomes almost a litmus test of
one’s suitability to be taken seriously.”

Paul Krugman

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor