dblouis
dblouis

Reputation: 608

Systemd unit does nothing

I need to mount a filesystem after another one but because there is apparently no way to specify an order in /etc/fstab, I made a systemd unit file like that:

[Unit]
Description=Mount
After=local-fs.target

[Service]
Type=simple
ExecStart=/bin/mount /mnt/dir

[Install]
WantedBy=multi-user.target

The problem is that it doesn't fail, but it doesn't succeed either. When I manually do systemctl restart <service> nothing happen, the filesystem is not mounted. If I do mount /mnt/dir it works though...

Upvotes: 1

Views: 367

Answers (1)

papey
papey

Reputation: 4134

Use a dedicated mount unit :

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

Adapt this to you need.

Upvotes: 1

Related Questions