2017-08-27 81 views
1

我需要一個又一個掛載文件系統,但因爲顯然沒有辦法/etc/fstab指定的順序,我做了一個systemd單元文件這樣的: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它的工作原理,但...

回答

1

使用專用的安裝單元:

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 

適應這個給你所需要的。

+0

這會在fstab全部掛載後運行嗎? – DBLouis

+0

https://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab – papey