Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to name a mount unit file having dash

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?

like image 949
deepan muthusamy Avatar asked Dec 27 '18 10:12

deepan muthusamy


People also ask

What is a .service file?

The database server requires a Services file, which contains information about the known services on your network. The Services file is typically located in %windir%\System32\drivers\etc\services.

Where do I put a custom systemd unit file?

Unit files are stored in the /usr/lib/systemd directory and its subdirectories, while the /etc/systemd/ directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host.

What is a systemd unit file?

A unit file is a plain text ini-style file that encodes information about a service, a socket, a device, a mount point, an automount point, a swap file or partition, a start-up target, a watched file system path, a timer controlled and supervised by systemd(1), a resource management slice or a group of externally ...


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

like image 161
KamilCuk Avatar answered Oct 13 '22 08:10

KamilCuk


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

like image 34
deepan muthusamy Avatar answered Oct 13 '22 08:10

deepan muthusamy