10

I have a mount unit file. "Where" directive is "Where=/Data/mnt-wt". How to name my .mount unit file? I read that '/' should be replaced with dash(-). Then dash should be replaced with what?

deepan muthusamy
  • 321
  • 2
  • 14
  • Stack Overflow is a site for programming and development questions. You should use another site on the [Stack Exchange network](https://stackexchange.com/sites) for this question. – jww Dec 27 '18 at 14:20

2 Answers2

8

The - gets substituted by \x2d. Use systemd-escape to escape strings for systemd.

> systemd-escape Data/mnt-wt.mount
Data-mnt\x2dwt.mount

Note that from https://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab you might prefer /etc/fstab if you are a human:

Mount units may either be configured via unit files, or via /etc/fstab (see fstab(5) for details). Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach to manage mounts for humans. For tooling, writing mount units should be preferred over editing /etc/fstab. See systemd-fstab-generator(8) for details about the conversion from /etc/fstab to mount units.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111
5

systemd-escape -p --suffix=mount "/mount/path". This command is more helpful to generate mount unit name.

deepan muthusamy
  • 321
  • 2
  • 14