我有本地文件服务器,它通过 SMB 导出两个位置:\media 和 \something
我想将它们安装为 /media/MEDIA (\media export) 和 /media/MEDIA/something (\something)。
为此,我创建了两个 .mount 单元:
=# cat /etc/systemd/system/media-MEDIA.mount
[Mount]
What=//media.server/Media/
Where=/media/MEDIA
Type=cifs
Options=guest,user
和
=# cat /etc/systemd/system/media-MEDIA-something.mount
[Mount]
What=//media.server/something/
Where=/media/MEDIA/something
Type=cifs
Options=guest,user
重新加载 systemctl,并验证一切正常。
但后来我想让它们在重新启动时自动安装。因此制作了自动安装单元:
=# cat /etc/systemd/system/media-MEDIA.automount
[Unit]
Requires=remote-fs-pre.target
After=remote-fs-pre.target
[Install]
WantedBy=remote-fs.target
和
=# cat /etc/systemd/system/media-MEDIA-something.automount
[Unit]
Requires=remote-fs-pre.target
After=remote-fs-pre.target media-MEDIA.automount
[Install]
WantedBy=remote-fs.target
重新加载/重新启动后 - 仅安装 /media/MEDIA。要安装“某物”,我必须手动:
=$ sudo systemctl start media-MEDIA-something.mount
/media/MEDIA,挂载后,确实包含目录“something”。
自动挂载已启用,但“某物”的自动挂载已损坏:
=# systemctl status media-MEDIA-something.automount
○ media-MEDIA-something.automount
Loaded: loaded (/etc/systemd/system/media-MEDIA-something.automount; enabled; preset: enabled)
Active: inactive (dead)
Triggers: ● media-MEDIA-something.mount
Where: /media/MEDIA/something
Nov 18 14:31:42 thebox systemd[1]: Dependency failed for media-MEDIA-something.automount.
Nov 18 14:31:42 thebox systemd[1]: media-MEDIA-something.automount: Job media-MEDIA-something.automount/start failed with result 'dependency'.
我缺少什么?我搞砸了什么?