linux - 如何命名带有破折号的挂载单元文件

标签 linux systemd mount

我有一个挂载单元文件。 “Where”指令是“Where=/Data/mnt-wt”。 如何命名我的 .mount 单元文件?我读到“/”应该用短划线 (-) 代替。那破折号应该换成什么?

最佳答案

- 被替换为 \x2d。使用 systemd-escape 为 systemd 转义字符串。

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

请注意,来自 https://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab如果您是人类,您可能更喜欢/etc/fstab:

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.

关于linux - 如何命名带有破折号的挂载单元文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53943112/

相关文章:

linux - grep awk 忽略字符

linux - 可执行路径不是绝对的,忽略: $(which node)

dbus - 如何定义d总线激活的systemd服务?

linux - 如何在Linux上将标签正确添加到AWS EBS卷设备的文件系统中?

windows - 暂时挂起PC操作系统

linux - 如何让 2 个变量具有 2 个不同的序列 - Bash Linux

linux - 什么更快?通过 nfs-mount 或通过 scp 复制?

linux - 如何以编程方式获取 syscall.Mount() 的文件系统类型

java - 在 Linux 上无需指定数据库名称即可通过 JDBC 连接到 MonetDB

linux - 使用 systemd 重启后 PostgreSQL 9.5 不启动