Re: Preventing writes to the underlying directory when a mounted filesystem disappears

Loïc Grenié <[email protected]> Mon, 27 Jul 2026 15:08:40 +0200
Newsgroups gmane.linux.debian.user
Message-ID <CAMLkfFSKb7CATRsuXkV4bZRyP0kUqx48rTyASrApk7er5C9Kaw@mail.gmail.com>
--000000000000a36ec90657976c02
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon 27 Jul, 2026, at 14:40, Nicolas George wrote:

> The Wanderer (HE12026-07-27):
> > That was my own first thought as well, but it only works if you have
> > that much control over the applications that will be writing the files
>
> According to the original statement, that is syslog. If there are other
> processes logging without going through rsyslog, it makes the issue that
> much difficult.
>
> > The only other fallback option that's occurred to me is to mount the
> > root filesystem read-only
>
> If the OP wants to avoid unwanted writes on the internal devices, I very
> much hope that is the very first thing they did.


    You can also mount a read-only ramdisk in between the root filesystem
  (if it needs to be mounted read-write) and the usb. Assuming the
  directory is /mnt/log. Something similar to those lines in /etc/fstab
  may (untested) work.

tmpfs   /mnt/log        tmpfs   defaults,ro        0 0
/dev/usb-block  /mnt/log   ext4  defaults  0 0

         Lo=C3=AFc

--000000000000a36ec90657976c02
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div style=3D"font-family:verdana,sans-se=
rif" class=3D"gmail_default"></div><div class=3D"gmail_default" style=3D"fo=
nt-family:verdana,sans-serif">On Mon 27 Jul, 2026, at 14:40, Nicolas George=
 wrote:</div></div><div class=3D"gmail_quote gmail_quote_container"><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex">The Wanderer (HE12026-07-27):<br=
>
&gt; That was my own first thought as well, but it only works if you have<b=
r>
&gt; that much control over the applications that will be writing the files=
<br>
<br>
According to the original statement, that is syslog. If there are other<br>
processes logging without going through rsyslog, it makes the issue that<br=
>
much difficult.<br>
<br>
&gt; The only other fallback option that&#39;s occurred to me is to mount t=
he<br>
&gt; root filesystem read-only<br>
<br>
If the OP wants to avoid unwanted writes on the internal devices, I very<br=
>
much hope that is the very first thing they did.</blockquote><div><br></div=
><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_default">=C2=
=A0 =C2=A0 You can also mount a read-only ramdisk in between the root files=
ystem</div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_def=
ault">=C2=A0 (if it needs to be mounted read-write) and the usb. Assuming t=
he</div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_defaul=
t">=C2=A0 directory is /mnt/log. Something similar to those lines in /etc/f=
stab</div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_defa=
ult">=C2=A0 may (untested) work.</div><div style=3D"font-family:verdana,san=
s-serif" class=3D"gmail_default"><br></div><div style=3D"font-family:verdan=
a,sans-serif" class=3D"gmail_default">tmpfs =C2=A0 /mnt/log=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 tmpfs =C2=A0 defaults,ro=C2=A0 =C2=A0 =C2=A0 =C2=A0 0 0<br></=
div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_default">/=
dev/usb-block=C2=A0 /mnt/log=C2=A0 =C2=A0ext4=C2=A0 defaults=C2=A0 0 0</div=
><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_default"><br>=
</div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_default"=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Lo=C3=AFc</div></div></div>

--000000000000a36ec90657976c02--