On Fri, Oct 14, 2016 at 1:06 PM, Michael Hirmke <camp...@mike.franken.de>

> Hi *,
> I've read the man pages and some more documentation about the mount
> behaviour of systemd, but I couldn't find a definitive answer to my
> questions.
> I have a backup script, that copies all files to backup to a hard disk
> partition, then duplicates the partition to one on a second disk, which
> in turn is changed every day. Before duplicating, the script tries to
> umount the partition on the original disk, does an fsck and then mounts
> the partition read only. When duplicating is finished, the original
> partition is remounted read write again.
> The script uses the "ancient" mount and umount commands, but once in a
> while, systemd takes over and remounts the disk, before fsck has been
> finished.
> So my questions are:
> 1. How can I prevent systemd from mounting a manually unmounted
>    partition? The partiton should be mounted automatically during system
>    start, though.

First, see if you can figure out *why* systemd mounted it.

systemd shouldn't generally start any unit on a whim – if the corresponding
.mount was started, then it likely was either by request, or as a
dependency of some program, or via autofs (if you use systemd.automount).

> 2. If I would switch from mount/umount to pure systemd behaviour for
>    mounting and unmounting partitons in my script, would a command like
>    "systemctl stop|start /var/backup" be sufficient?

Looks about right, though in some cases `systemctl foo var-backup.mount`
might be needed.

But, I don't think it will make any difference.

>    And how would a remount command (for read only or read write) look
>    like?

There isn't any. Use `mount`.

Mantas Mikulėnas <graw...@gmail.com>
systemd-devel mailing list

Reply via email to