How to name systemd mount unit properly?

chs_voks asked:

I’m trying to automount CephFS after boot via systemd

I’ve got the next unit:

[Unit]
SourcePath=/etc/fstab
DefaultDependencies=no
After=remote-fs-pre.target
After=network.target
Wants=network.target
After=network-online.target
Wants=network-online.target
Conflicts=umount.target
Before=umount.target

[Mount]
What=ceph-node1:6789,ceph-node2:6789,ceph-node3:6789:/dev
Where=/mnt/cephfs-dev
Type=ceph
Options=name=devuser,secretfile=/etc/ceph/cephuser.secret

[Install]
WantedBy=remote-fs.target

As I know Where= setting must match unit name. I do next:

[root@centos system]# systemd-escape -p --suffix=mount '/mnt/cephfs-dev'
mnt-cephfs\x2ddev.mount
[root@centos system]# vi /etc/systemd/system/mnt-cephfs\\x2ddev.mount

But something went wrong:

[root@centos system]# systemctl status mnt-ceph\\x2ddev.mount
‚óŹ mnt-ceph\x2ddev.mount - /mnt/cephfs-dev
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
    Where: /mnt/cephfs-dev
     What: ceph-node1:6789,ceph-node2:6789,ceph-node3:6789:/dev

May 05 10:07:12 centos.imoldovan-lpt systemd[1]: mnt-ceph\x2ddev.mount's Where= setting doesn't match unit name. Refusing.

How to name unit properly? Obviously the problem with a dash in mount point /mnt/cephfs-dev but I need exactly this mount point.

My answer:


To put some closure to this:

The problem was that mnt-ceph\x2ddev.mount was a typo. It should have been mnt-cephfs\x2ddev.mount instead.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.