mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)
On Tue May 20, 2025 at 3:50 PM BST, Dan Purgert wrote:
I used /mnt/backup because I only wanted the partition mounted while
the backup was running (it was one of several on that physical drive).
The backup script did the mount/rsync/unmount as part of the
execution. Really, the only point of this was a "well, I can't
accidentally delete it if it's not mounted" train of thought.
I can sympathize with that. I use a similar approach, except using
systemd features. My backup jobs are systemd services, which depend upon
backup.mount (⇒ /backup), which is configured with
StopWhenUnneeded=true. The filesystem is mounted only when a backup
service starts, and is unmounted when it stops.
I'd actually like to do this differently: I'd like /backup permanently
mounted, but in a separate mount namespace from the main system. And I'd
like backup jobs to enter that namespace. I haven't managed to get
something like this working with systemd features.
--
Please do not CC me for listmail.
👱🏻 Jonathan Dowland
✎ jmtd@debian.org
🔗 https://jmtd.net
Reply to: