[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)



On May 21, 2025, Jonathan Dowland wrote:
> 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

Hah, that old script was from way back in 2004(? '05?); so systemd
definitely wasn't an option at the time. :)

>[...]

> 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.

As far as I know namespaces (read: poorly), the backup script would need
to execute setns(2) in order to join the previously created namespace
for your "/backup" target.  But, I've only used them with networking
devices, so there may be other caveats here.
> 
> -- 
> Please do not CC me for listmail.
> 
> 👱🏻	Jonathan Dowland
> ✎	 jmtd@debian.org
> 🔗	https://jmtd.net
> 

-- 
|_|O|_| 
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1  E067 6D65 70E5 4CE7 2860

Attachment: signature.asc
Description: PGP signature


Reply to: