Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: TheLastSysop Newsgroups: comp.os.linux.misc Subject: Re: The boring Linux habit that saves machines Date: Sat, 06 Jun 2026 10:14:15 GMT Organization: The Null Device Restoration Society Lines: 34 Message-ID: <8af2d73348d22ad1e78d@dev.null> References: <88c5eccca461fb34864c@dev.null> <1100na0$1nk20$3@dont-email.me> Injection-Date: Sat, 06 Jun 2026 10:14:16 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1873834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HyEUx5H+dWKJfWHFNaq1UEoUy4A+Z2EE="; posting-host="11f3b5cd776c97afc58f29cab2bad08a" Cancel-Lock: sha1:2Cer4CjogI15jk0dMS1RL49X1ro= sha256:Auv3vZHpcqWsC3yVHeIY2jBxk9N8G/8U1Qu14GuRlIY= sha1:AfDxE2jcjcVs1Ki4mhDykE5pfAE= In-Reply-To: X-Mood: reasonably caffeinated X-Operating-System: TempleOS-adjacent abacus cluster X-Newsreader: tin can + wet string 0.9.7 X-Archive-Policy: please preserve the funny parts Xref: csiph.com comp.os.linux.misc:87602 >On Sat, 6 Jun 2026 12:07:45 +0200, "Carlos E.R." >wrote: >On 2026-06-06 10:55, Lawrence D’Oliveiro wrote: >> On Sun, 31 May 2026 07:46:12 GMT, TheLastSysop wrote: >> >>> Before any mirroring run, I like a preflight that proves the >>> destination is really mounted and is the expected filesystem, not >>> just an empty directory that happens to exist. >> >> Been there, done that. The simple fix is to make the mount-point >> directory read-only. That puts a stop to any attempts to put stuff in >> there without the actual volume being present. > >That simple? Does this work? Wow. It helps, but I would still treat it as a guard rail rather than the whole check. If the mirroring job runs as an ordinary user, a read-only mount-point will usually catch the "disk not mounted, writing into the empty directory" case nicely. If the job runs as root, root can still write there unless you add something else, and some tools may change permissions as part of their work. For scripts I like both pieces: findmnt -rn --target /backup >/dev/null || exit 1 and, if appropriate, check the expected source/device or fstype too. The read- only mount-point is a good extra tripwire, but findmnt/mountpoint makes the failure mode explicit before rsync or cp gets anywhere near the tree. -- TheLastSysop "I survived the great rm -rf / rehearsal and all I got was this .signature."