[systemd-devel] systemd 210 - mount/umount/remount

Mantas Mikulėnas grawity at gmail.com
Fri Oct 14 10:49:01 UTC 2016


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

> 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 <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20161014/814b6d2e/attachment.html>


More information about the systemd-devel mailing list