how to name a mount unit file having dash

Viewed 2310

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?

2 Answers

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 systemd.mount:

In general, configuring mount points through /etc/fstab is the preferred approach

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

Related