jvillain
8th January 2011, 08:55 PM
I don't know if any one can help with this but I will give it a shot. I am trying to get auto-mounting working with systemd files. I know it can be done in the fstab but I want to try and get it working with the systemd files.
My under standing is that you need a .mount file and a matching .automount file and they should be in
/lib/systemd/system
In my case I am trying to nfs4 mount server1:/data at /data. I would like to have it available in the equivalent of run levels 3 and 5.
So first I created the file data.mount as follows.
[Unit]
Description=Data Directory
Wants=network.target statd.service
After=network.target statd.service
[Mount]
What=server1:/data
Where=/data
Type=nfs4
StandardOutput=syslog
StandardError=syslog
I then created the file data.automount
[Unit]
Description=Data Directory Automount Point
Wants=network.target statd.service
After=network.target statd.service
[Automount]
Where=/data
[Install]
WantedBy=multi-user.target
multi-user.target is a requirement of graphical.target so I figured if I installed it in multi-user.target it would be available in both. So I run
systemctl enable data.automount
And it does the following just like I wanted.
ln -s '/lib/systemd/system/data.automount' '/etc/systemd/system/multi-user.target.wants/data.automount'
But if I reboot the system and come up into the graphical.target then check the status the data.automount service is in the failed state. But if I do
systemctl start data.automount
it starts just fine. Permissions on both files I created are 644 just like the others. Can any one give me some advise for what I am doing wrong?
It seems pretty well every distro is giving systemd a go and there is documentation popping up, but I haven't seen any examples of systemd automount yet.
Some pages I looked at
http://0pointer.de/public/systemd-man/systemd.automount.html
http://0pointer.de/public/systemd-man/systemd.service.html
http://0pointer.de/public/systemd-man/systemd.unit.html
Thanks for any help.
My under standing is that you need a .mount file and a matching .automount file and they should be in
/lib/systemd/system
In my case I am trying to nfs4 mount server1:/data at /data. I would like to have it available in the equivalent of run levels 3 and 5.
So first I created the file data.mount as follows.
[Unit]
Description=Data Directory
Wants=network.target statd.service
After=network.target statd.service
[Mount]
What=server1:/data
Where=/data
Type=nfs4
StandardOutput=syslog
StandardError=syslog
I then created the file data.automount
[Unit]
Description=Data Directory Automount Point
Wants=network.target statd.service
After=network.target statd.service
[Automount]
Where=/data
[Install]
WantedBy=multi-user.target
multi-user.target is a requirement of graphical.target so I figured if I installed it in multi-user.target it would be available in both. So I run
systemctl enable data.automount
And it does the following just like I wanted.
ln -s '/lib/systemd/system/data.automount' '/etc/systemd/system/multi-user.target.wants/data.automount'
But if I reboot the system and come up into the graphical.target then check the status the data.automount service is in the failed state. But if I do
systemctl start data.automount
it starts just fine. Permissions on both files I created are 644 just like the others. Can any one give me some advise for what I am doing wrong?
It seems pretty well every distro is giving systemd a go and there is documentation popping up, but I haven't seen any examples of systemd automount yet.
Some pages I looked at
http://0pointer.de/public/systemd-man/systemd.automount.html
http://0pointer.de/public/systemd-man/systemd.service.html
http://0pointer.de/public/systemd-man/systemd.unit.html
Thanks for any help.