2

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.

  • So change the name of the unit to match the mount point. – Michael Hampton May 5 '16 at 8:03
  • The unit is alredy have right name "mnt-cephfs\x2ddev.mount" but I still have got an error – chs_voks May 5 '16 at 8:16
  • That's not the name of the unit given in your question! – Michael Hampton May 5 '16 at 8:18
0

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.

0

Mount units must be named after the mount point directories they control. Example: the mount point /home/lennart must be configured in a unit file home-lennart.mount.

Mount] What=/dev/vdc Where=/a/b/c Type=xfs Unit file name must be "a-b-c.mount", /usr/lib/systemd/system/a-b-c.mount

  • This is all true, but it's completely useless to solve the problem. – Michael Hampton Feb 15 '17 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.