Systemd 单元什么都不做
Systemd unit does nothing
我需要一个接一个地挂载文件系统,但因为显然无法在 /etc/fstab
中指定顺序,所以我制作了一个这样的 systemd 单元文件:
[Unit]
Description=Mount
After=local-fs.target
[Service]
Type=simple
ExecStart=/bin/mount /mnt/dir
[Install]
WantedBy=multi-user.target
问题是它没有失败,但也没有成功。当我手动执行 systemctl restart <service>
时没有任何反应,文件系统没有挂载。如果我这样做 mount /mnt/dir
它会起作用...
使用专用安装单元:
https://www.freedesktop.org/software/systemd/man/systemd.mount.html
[Unit]
Description=Mount Unit
After=another-mount.mount
[Mount]
What=/something
Where=/to/destination
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
根据您的需要进行调整。
我需要一个接一个地挂载文件系统,但因为显然无法在 /etc/fstab
中指定顺序,所以我制作了一个这样的 systemd 单元文件:
[Unit]
Description=Mount
After=local-fs.target
[Service]
Type=simple
ExecStart=/bin/mount /mnt/dir
[Install]
WantedBy=multi-user.target
问题是它没有失败,但也没有成功。当我手动执行 systemctl restart <service>
时没有任何反应,文件系统没有挂载。如果我这样做 mount /mnt/dir
它会起作用...
使用专用安装单元:
https://www.freedesktop.org/software/systemd/man/systemd.mount.html
[Unit]
Description=Mount Unit
After=another-mount.mount
[Mount]
What=/something
Where=/to/destination
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
根据您的需要进行调整。